CreateIndexOperation constructor
CreateIndexOperation(
- Db db,
- DbCollection collection,
- Object fieldOrSpec,
- CreateIndexOptions? indexOptions, {
- Connection? connection,
- Map<
String, Object> ? rawOptions,
Implementation
CreateIndexOperation(Db db, DbCollection collection, this.fieldOrSpec,
CreateIndexOptions? indexOptions,
{Connection? connection, Map<String, Object>? rawOptions})
: super(db, <String, Object>{...?indexOptions?.options, ...?rawOptions},
collection: collection,
aspect: Aspect.writeOperation,
connection: connection) {
// parseIndexOptions alway returns a filled "keyName" and a "keyFieldHash"
// elements
var indexParameters = parseIndexOptions(fieldOrSpec);
final indexName = options[keyName] != null && options[keyName] is String
? options[keyName] as String
: indexParameters[keyName] as String;
indexes = {keyName: indexName, keyKey: indexParameters[keyFieldHash]!};
options.remove(keyName);
}