![](/img/trans.png)
[英]How do you perform db.collection.explain() in C# driver 2.7.0 on Mongo Server 4.0?
[英]How do you create a full text search for all text fields in a mongo collection in the c# driver?
我觉得这应该很简单,但我有一个谷歌,无法准确找到我正在寻找的东西。
我可以在 mongo 控制台中应用以下代码:
db.collection.createIndex( { "$**": "text" } )
我将在我的集合中的所有文本字段上获得全文索引。 如何在mongo c# 驱动程序中的给定集合上实现相同的结果?
您可以使用以下内容创建通配符文本索引。
collection.Indexes.CreateOne(
new CreateIndexModel<MyType>(
Builders<MyType>.IndexKeys.Text("$**")));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.