mongodb - Mongo DB error: invalid operator: $search when doing $text search -


मैंने इसके साथ एक सूचक बनाया है:

  db.MyCollection.ensureIndex ({ "फ़ील्ड 1": "टेक्स्ट"})   

और मैं निम्नलिखित को रोबोमोंगो में चला रहा हूं:

  db.MyCollection.find ({$ text: {$ search: "something"}})   

और इस त्रुटि को वापस पाने के लिए:

  त्रुटि: {"$ err": "अमान्य ऑपरेटर: $ खोज "," कोड ": 10068}   

डॉक्स बहुत स्पष्ट लग रहे हैं कि मैं सही सिंटैक्स का उपयोग कर रहा हूं:। मैं मोंगो संस्करण 2.4.9 का उपयोग कर रहा हूँ। किसी को भी पता है कि समस्या यहाँ क्या हो सकती है?

मुंगो 2.6+ $ text इस प्रकार से कार्य करता है:

  db.collection.insert ({desc: "यह पाठ के साथ एक स्ट्रिंग है"}); Db.collection.insert ({desc: "यह टेक्स्ट के साथ एक और स्ट्रिंग है"}); Db.collection.insert ({desc: "यह ext के साथ एक अन्य स्ट्रिंग है"}); db.collection.ensureIndex ({ "desc": "पाठ"}); Db.collection.find ({$ text: {$ खोज: "टेक्स्ट"}});   

यह आउटपुट को निम्न के रूप में देगा:

  {"_id": ObjectId ("553277a608b85f33165bf3e0"), "desc": "यह एक अन्य स्ट्रिंग है टेक्स्ट "} {" _id ": ObjectId (" 5532779f08b85f33165bf3df ")," desc ":" यह टेक्स्ट के साथ एक स्ट्रिंग है "}   

इसके अलावा यदि आप मॉगो संस्करण 2.4 का उपयोग कर रहे हैं तो निम्न का उपयोग करें : <पूर्व> db.collection.ensureIndex ({"desc": "text"}); Db.collection.runCommand ("desc", {search: "text"})

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -