Does MongoDb C# Samus have Indexing feature?
I was trying out MongoDb c# driver by Samus. Is there any way to index the documents using this driver? D开发者_开发技巧oes it provide that feature? If it does please let me know how to. I could not find proper documentation for this.
Regards, Lalith
You can use MongoDB.CollectionMetadata to create indexed in mongo db
Below the sample
CollectionMetadata cmd = DB["indextests"].MetaData;
cmd.CreateIndex("lastnames", new Document().Add("lname", IndexOrder.Ascending), false);
Dictionary<string, Document> indexes = cmd.Indexes;
精彩评论