Is MongoDB’s Case-Insensitivity Identical To JavaScript’s Case-Insensivity?

analog-nico Source

I am doing a case-insensitive query on MongoDB like this:

db.getCollection('users').find({ name: /some regex/i })

Will MongoDB always return exactly the same object subset that I would otherwise get from using this JavaScript code which has the same objects in memory?

users.filter((obj) => { return regex/i) })

I am wondering if the case-insensitivity is identical for both. It of course apparently is but I wonder if there are special characters that maybe MongoDB sees as the same whereas JavaScript does not. Or vice versa.



comments powered by Disqus