Reputation: 583
I feel like this should be really simple, yet I've had a google and can't find exactly what I'm looking for.
I can apply the following code in the mongo console:
db.collection.createIndex( { "$**": "text" } )
and I'll get a full text index on all text fields in my collection. How do I achieve this same result on a given collection in the mongo c# driver ?
Upvotes: 1
Views: 376
Reputation: 5669
you can create a wildcard text index with the following.
collection.Indexes.CreateOne(
new CreateIndexModel<MyType>(
Builders<MyType>.IndexKeys.Text("$**")));
Upvotes: 1