0

I tried to query:

bson.M{"name": bson.M{"$regex": bson.RegEx{Pattern: "sophia", Options: "i"}} 

but, it also query out which part matched with "sophia".

I only want to query out the items which case insensitive.

3
  • e.g the items with name "so" also be queried from above code Commented May 18, 2018 at 9:21
  • I don't understand your question. You seem to be saying that the query does what you want... ? Commented May 18, 2018 at 9:22
  • In addition to using a correct regular expression to match your "word only", if you go way down the list of answers on the MongoDB specific question you will see one that covers case insensitive collation as is now supported in modern releases of MongoDB. This would generally be preferable for an "exact match" than using a regex. Commented May 18, 2018 at 9:36

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.