ensureIndex method
void
ensureIndex(
- dynamic keys, {
- String key = '',
- bool unique = false,
- bool sparse = false,
- bool background = false,
- bool dropDups = false,
- Map<
String, dynamic> ? partialFilterExpression, - String name = '',
inherited
Adds index definition to create it on opening
keys
index keys (fields)options
index options
Implementation
void ensureIndex(keys,
{String key = '',
bool unique = false,
bool sparse = false,
bool background = false,
bool dropDups = false,
Map<String, dynamic>? partialFilterExpression,
String name = ''}) {
if (keys == null) return;
_indexes.add(MongoDbIndex(keys, key, unique, sparse, background, dropDups,
partialFilterExpression ?? <String, dynamic>{}, name));
}