findAndModify method
Modifies and returns a single document. By default, the returned document does not include the modifications made on the update. To return the document with the modifications made on the update, use the returnNew option.
Implementation
Future<Map<String, dynamic>?> findAndModify(
{query,
sort,
bool? remove,
update,
bool? returnNew,
fields,
bool? upsert}) async {
if (db._masterConnectionVerified.serverCapabilities.supportsOpMsg) {
var result = await modernFindAndModify(
query: query,
sort: sort,
remove: remove,
update: update,
returnNew: returnNew,
fields: fields,
upsert: upsert);
return result.value;
}
return legacyFindAndModify(
query: query,
sort: sort,
remove: remove,
update: update,
returnNew: returnNew,
fields: fields,
upsert: upsert);
}