deleteMany method
Removes all documents from the collection that matches the given filter. If no documents match, the collection is not modified.
Implementation
Future<int> deleteMany([filter]) async {
// force sending an empty filter instead asserting
if (filter == null) {
filter = Map<String, dynamic>();
} else {
assert(filter is Map<String, dynamic> || filter is LogicalQueryOperator);
if (filter is Map<String, dynamic>) {
// convert 'QuerySelector' into map, too
filter.forEach((dynamic key, value) {
if (value is QueryOperator) {
filter[key] = value.values;
}
});
}
if (filter is LogicalQueryOperator) {
filter = filter.values;
}
}
var result = await FlutterMongoRealm.deleteDocuments(
collectionName: this.collectionName,
databaseName: this.databaseName,
filter: BsonDocument(filter).toJson(),
);
return result;
}