/// <summary> /// List all unique indexes (excluding _id index) /// </summary> public IEnumerable <string> GetUniqueIndexes(string collection) { var col = _collections.Get(collection); foreach (var index in col.Indexes.Where(x => x.Field != "_id" && x.Unique)) { yield return(index.Field); } }
/// <summary> /// List all indexes keys with unique information /// </summary> public IEnumerable <KeyValuePair <string, bool> > GetIndexes(string collection) { var col = _collections.Get(collection); foreach (var index in col.Indexes.Where(x => x.Field != "_id" && string.IsNullOrEmpty(x.Field) == false)) { yield return(new KeyValuePair <string, bool>(index.Field, index.Options.Unique)); } }