【发布时间】:2016-02-01 15:45:07
【问题描述】:
我想为数组中的多个字段和元素字段创建文本索引。目前我将数组元素的路径定义为一个字符串,它可以工作。有没有办法像我对这样的简单字段使用表达式:
var textIndex = Builders<Project>.IndexKeys
.Text(p => p.Name)
.Text(p => p.Description)
// This and any other expression I tried does not work
//.Text(p => p.System.Elements.SelectMany(e => e.Name))
// But this works fine:
.Text("system.elements.name");
await collection.Indexes.CreateOneAsync(textIndex);
我正在使用 mongodb 3.2 和 MongoDB.Driver 2.2.2
【问题讨论】:
-
据了解,目前尚不支持。有一张开放的 JIRA 票:jira.mongodb.org/browse/…
标签: c# mongodb mongodb-.net-driver mongodb-csharp-2.0