MongoDB: Is it possible to make a case-insensitive query? -


उदाहरण:

  & gt; db.stuff.save ({ "foo": "बार"}); & Gt; । Db.stuff.find ({ "foo": "बार"}) गिनती (); 1 & gt; । Db.stuff.find ({ "foo": "बार"}) गिनती (); 0  

आप उपयोग कर सकते हैं।

आपके उदाहरण में होगा:

  db.stuff.find ({foo: / ^ बार $ / i});  

मुझे कहना चाहिए, यद्यपि, शायद आप इसे जितना भी समय पाते हैं उतनी अतिरिक्त लागत के बजाय रास्ते में मूल्य को डाउनकेस (या अपकेस) कर सकते हैं। जाहिर है, यह लोगों के नामों और ऐसे लोगों के लिए काम नहीं करता है, लेकिन हो सकता है कि वे टैग्स जैसे- टैग का उपयोग करें।


Comments

Popular posts from this blog

iphone - How do I make a UIPickerView in a UIActionSheet -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -