Add index to document or subdocument at Mongodb C#

3/2/2014·1 min read
// add index to document's field
collection.CreateIndex(IndexKeys.Ascending(_ => _.FieldName));
// add index to subdocument's field
collection.CreateIndex("SubDocument.FieldName");