execute method

  1. @override
Future<Map<String, dynamic>> execute({
  1. bool skipStateCheck = false,
})
inherited

Implementation

@override
Future<Map<String, dynamic>> execute({bool skipStateCheck = false}) async {
  final db = this.db;
  if (!skipStateCheck && db.state != State.open) {
    throw MongoDartError('Db is in the wrong state: ${db.state}');
  }
  //final options = Map.from(this.options);

  // Todo implement topology
  // Did the user destroy the topology
  /*if (db?.serverConfig?.isDestroyed() ?? false) {
    return callback(MongoDartError('topology was destroyed'));
  }*/

  var command = $buildCommand();

  processOptions(command);

  command.addAll(options);

  if (readPreference != null) {
    // search for the right connection
  }

  // Todo remove debug()
  //print(command);
  var modernMessage = MongoModernMessage(command);

  return db.executeModernMessage(modernMessage,
      connection: connection, skipStateCheck: skipStateCheck);
}