I\'ve programmatically created a new document collection using the MongoDB C# driver.
At this point I want to create and build indexes programmatically. How can I do
Something like this should do:
var server = MongoServer.Create("mongodb://localhost");
var db = server.GetDatabase("myapp");
var users = db.GetCollection("users");
users.EnsureIndex(new IndexKeysBuilder().Ascending("EmailAddress"));
Please see the following bits in the documentation: