updateByExample method

Future<int> updateByExample(
  1. Map<String, dynamic> example,
  2. Map<String, dynamic> newValue,
  3. {int limit,
  4. bool keepNull,
  5. bool waitForSync,
  6. bool mergeObjects}
)

Implementation

Future<int> updateByExample(
  Map<String, dynamic> example,
  Map<String, dynamic> newValue, {
  int limit,
  bool keepNull,
  bool waitForSync,
  bool mergeObjects,
}) async {
  final resp = await _connection
      .request(method: 'PUT', path: '/_api/simple/update-by-example', body: {
    if (limit != null) 'limit': limit,
    if (keepNull != null) 'keepNull': keepNull,
    if (waitForSync != null) 'waitForSync': waitForSync,
    if (mergeObjects != null) 'mergeObjects': mergeObjects,
    'example': example,
    'newValue': newValue,
    'collection': name
  });
  return resp.body['updated'];
}