Using .Net MongDb.Driver version 3.2.
Call this code once:
IMongoCollection<Contest> Contests = iMongoDatabase!.GetCollection<Contest>(collectionName);
var indexModel = new CreateIndexModel<Contest>(Builders<Contest>.IndexKeys.Ascending(c => c.Name));
Contests.Indexes.CreateOne(indexModel);
Then I call InsertOne twice, using the same Name value. I’d expect only one Document to get inserted but both are inserted with the same Name.
Github repo: GitHub - skippyV/MongoDbNetIndexTest: Testing Indexes on MongoDB with .Net driver