FindAndModifyOperation constructor

FindAndModifyOperation(
  1. DbCollection collection, {
  2. Map<String, dynamic>? query,
  3. Map<String, Object>? sort,
  4. bool? remove,
  5. Object? update,
  6. bool? returnNew,
  7. Map<String, dynamic>? fields,
  8. bool? upsert,
  9. List? arrayFilters,
  10. String? hint,
  11. Map<String, Object>? hintDocument,
  12. FindAndModifyOptions? findAndModifyOptions,
  13. Map<String, Object>? rawOptions,
})

Implementation

FindAndModifyOperation(DbCollection collection,
    {this.query,
    this.sort,
    bool? remove,
    this.update,
    bool? returnNew,
    this.fields,
    bool? upsert,
    this.arrayFilters,
    this.hint,
    this.hintDocument,
    FindAndModifyOptions? findAndModifyOptions,
    Map<String, Object>? rawOptions})
    : remove = remove ?? false,
      returnNew = returnNew ?? false,
      upsert = upsert ?? false,
      super(
          collection.db,
          <String, Object>{
            ...?findAndModifyOptions?.getOptions(collection.db),
            ...?rawOptions
          },
          collection: collection,
          aspect: Aspect.writeOperation) {
  if (arrayFilters != null && arrayFilters is! List && arrayFilters is! Map) {
    throw MongoDartError(
        'The arrayFilters parameter must be either a List or a Map');
  }
}