update method

Future<WriteResult> update(
  1. Map<String, dynamic> doc, {
  2. bool upsert = true,
})

this will update certain values presented in the doc object

Implementation

Future<WriteResult> update(
  Map<String, dynamic> doc, {
  bool upsert = true,
}) async {
  var selector = where.eq('_id', _id);
  var updateQuery = modify;
  doc.forEach((key, value) {
    updateQuery = updateQuery.set(key, value);
  });
  return _collRef.updateOne(selector, updateQuery, upsert: upsert);
}