$buildCommand method

  1. @override
Map<String, Object> $buildCommand()

Implementation

@override
Map<String, Object> $buildCommand() {
  var indexes = this.indexes;

  // merge all options
  var added = <String>[];
  for (var optionName in options.keys) {
    if (!keysToOmit.contains(optionName) && options[optionName] != null) {
      indexes[optionName] = options[optionName]!;
      added.add(optionName);
    }
  }
  for (var optionName in added) {
    options.remove(optionName);
  }

  // Create command, apply write concern to command
  return <String, Object>{
    keyCreateIndexes: collection!.collectionName,
    keyCreateIndexesArgument: [indexes]
  };
}