mWrite method
Creates or replaces
large amounts of documents
as fast as possible.
Implementation
Future<Map<String, dynamic>> mWrite(String index, String collection,
List<Map<String, dynamic>> documents) async {
final response = await kuzzle.query(KuzzleRequest(
action: 'mWrite',
collection: collection,
controller: name,
index: index,
body: <String, dynamic>{
'documents': documents,
},
));
final result = response.result as Map<String, dynamic>;
if (result['successes'] is List && result['errors'] is List) {
return result;
}
throw BadResponseFormatError(
response.error?.id, '$name.exists: bad response format', response);
}