I am trying to recreate indexes from one collection for another.
I can get the existing index from the source collection by:
var sourceCollectionName = "source";
var targetCollectionName = "target";
var sourceCollection = db.GetCollection<BsonDocument>(sourceCollectionName);
var targetCollection = db.GetCollection<BsonDocument>(targetCollectionName);
List<BsonDocument> sourceCollectionIndexes = await(await sourceCollection.Indexes.ListAsync()).ToListAsync();
But I cannot figure out where to go from there.