0
我试图通过自由文本获取文档。 这一部分,通过现场获取数据的工作原理确定和返回数据:Meteor.publish() - 如何通过自由文本获取文档
Meteor.publish("messages", function(){
return Messages.find({ discussion_id: "discus_id_87" });
});
这一个不工作:
Meteor.publish("messages", function(){
return Messages.find({ $text: { $search: "Some text" } });
});
返回一个错误:
Error: Exception while polling query {"collectionName":"messages","selector":{"$text":{"$search":"Some text"}},"options":{"transform":null}}: Unable to execute query: error processing query: ns=meteor.messages limit=0 skip=0
这是一个来自mongoDB的示例$text
db.articles.find({ $text: { $search: "bake coffee -cake" } })
我做错了什么? 如何通过自由文本获取文档?
谢谢
确保您蒙戈数据库是2.6版本。这是一个相对较新的MongoDB功能。 – Akshat
MongoDB shell版本:2.6.10,但在应用程序中:[email protected]。它如何在旧版本上实现? – Pumych
在较早的版本中,语法略有不同,它需要在mongodb.conf中进行设置才能启用它。 – Akshat