deleteOneFromMap method
Same as deleteOne but in Map format: Schema: { deleteOne : { "filter" :
Implementation
void deleteOneFromMap(Map<String, Object> docMap, {int? index}) {
var contentMap = docMap[bulkFilter];
if (contentMap is! Map<String, Object>) {
throw MongoDartError('The "$bulkFilter" key of the '
'"$bulkDeleteOne" element '
'${index == null ? '' : 'at index $index '}must contain a Map');
}
if (docMap[bulkCollation] != null &&
docMap[bulkCollation] is! CollationOptions &&
docMap[bulkCollation] is! Map<String, dynamic>) {
throw MongoDartError('The "$bulkCollation" key of the '
'"$bulkDeleteOne" element ${index == null ? '' : 'at index $index '}must '
'contain a CollationOptions element or a Map representation '
'of a collation');
}
if (docMap[bulkHint] != null && docMap[bulkHint] is! String) {
throw MongoDartError('The "$bulkHint" key of the '
'"$bulkDeleteOne" element '
'${index == null ? '' : 'at index $index '}must '
'contain a String');
}
if (docMap[bulkHintDocument] != null &&
docMap[bulkHintDocument] is! Map<String, Object>) {
throw MongoDartError('The "$bulkHintDocument" key of the '
'"$bulkDeleteOne" element '
'${index == null ? '' : 'at index $index '}must '
'contain a Map');
}
deleteOne(DeleteOneStatement(contentMap,
collation: docMap[bulkCollation] is Map<String, dynamic>
? CollationOptions.fromMap(
docMap[bulkCollation] as Map<String, Object>)
: docMap[bulkCollation] as CollationOptions?,
hint: docMap[bulkHint] as String?,
hintDocument: docMap[bulkHintDocument] as Map<String, Object>?));
}