执行Mongo查询db.collection.runCommand("text",{"search":“" search text“}) [英] Executing Mongo query db.collection.runCommand("text",{"search":"search text"})
本文介绍了执行Mongo查询db.collection.runCommand("text",{"search":“" search text“})的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在我的网站,mongodb中的数据库中添加全文搜索选项, Mongo查询:
I need to add full text search option in my site, database in mongodb, Mongo Query:
db.collection.runCommand("text",{"search":"search text"})
给出结果,但是如何使用C#执行呢?
Gives result, but how to execute it using C#?
推荐答案
我认为您正在寻找:
var commandResult = collection.RunCommand(aggregationCommand);
var response = commandResult.Response;
foreach (BsonDocument result in response["results"].AsBsonArray)
{
// process result
}
一个很好的例子,但有一些汇总,可以在这里找到: https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/8dM1LnHh9-Q
fine example but with aggregate can be found here: https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/8dM1LnHh9-Q
这篇关于执行Mongo查询db.collection.runCommand("text",{"search":“" search text“})的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文