GetLastErrorCommand constructor

GetLastErrorCommand(
  1. Db db, {
  2. WriteConcern? writeConcern,
  3. GetLastErrorOptions? getLastErrorOptions,
  4. Map<String, Object>? rawOptions,
})

Implementation

GetLastErrorCommand(Db db,
    {WriteConcern? writeConcern,
    GetLastErrorOptions? getLastErrorOptions,
    Map<String, Object>? rawOptions})
    : super(db, <String, Object>{
        ...?getLastErrorOptions?.options,
        ...?rawOptions
      }, command: <String, Object>{
        keyGetLastError: 1,
        //keyDbName: db.databaseName,
      }) {
  if (writeConcern != null) {
    options = {
      ...writeConcern.asMap(db.masterConnection.serverStatus)
        ..remove(keyFsync),
      ...options,
    };
  }

  /// If not specified, set a default timeout in case "w" have been set
  if ((options.containsKey(keyWriteConcern) || options.containsKey(keyW)) &&
      !options.containsKey(keyWtimeout)) {
    options[keyWtimeout] = 5000;
  }
}