title: How do I create a text index in mongodb with golang and the mongo-go-driver?
body: <p>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?</p>
  
  <p>I know that I must use a thing as this:</p>
  
  <pre><code>opts := options.CreateIndexes().SetMaxTime(10 * time.Second)
  
  idxFiles := []mongo.IndexModel{
      {
        Keys: bsonx.Doc{{"name": "text"}},
      },
    }
  
  db.Collection("mycollection").Indexes().CreateMany(context, idx, opts)
  </code></pre>