delete method

Future<bool> delete(
  1. String id
)

Deletes a document from the collection by its ID.

The id should be a valid MongoDB ObjectId string.

Returns true if the deletion was successful, otherwise false.

Implementation

Future<bool> delete(String id) async {
  var oid = ObjectId.tryParse(id);
  if (oid != null) {
    var res = await collection.deleteOne(where.id(oid));
    return res.success;
  }

  return false;
}