Create a text index for the fields in the array using the expression

I want to create a text index for several fields and fields of elements in an array. I am currently defining a path to the elements of an array as a string that works. Is there a way to use the expression in the same way as I can do for simple fields like:

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); 

I am using mongodb 3.2 and MongoDB.Driver 2.2.2

+5
source share

Source: https://habr.com/ru/post/1242010/


All Articles