I'm trying to do a full text search on a collection, but in order to do that I need to create a text index. How can I create a text index on two fields?
I know that I must use a thing as this:
opts := options.CreateIndexes().SetMaxTime(10 * time.Second)
idxFiles := []mongo.IndexModel{
{
Keys: bsonx.Doc{{"name": "text"}},
},
}
db.Collection("mycollection").Indexes().CreateMany(context, idx, opts)