updateAllForField method

Future<void> updateAllForField({
  1. required String field,
  2. required Object? value,
  3. required Map<String, Object?>? filter,
})

Updates a specific field for all documents that match the given filter.

The field specifies the field to be updated, and value is the new value to be assigned. The filter map is used to specify the matching condition.

Implementation

Future<void> updateAllForField({
  required String field,
  required Object? value,
  required Map<String, Object?>? filter,
}) async {
  await collection.updateMany(
    filter,
    modify.set(field, value),
  );
}