SDK
SDK Dart Null Safety v3.x
2

mUpdate #

Updates multiple documents.


Arguments #

Copied to clipboard!
Future<Map<String, dynamic>> mUpdate(
      String index, String collection, 
      List<Map<String, dynamic>> documents,
      {
      bool waitForRefresh = false, 
      int retryOnConflict
})
Arguments Type Description
index
String
Index
collection
String
Collection
documents
List<Map<String, dynamic>>
List containing the documents to update
retryOnConflict
int

(null)
The number of times the database layer should retry in case of version conflict
waitForRefresh
bool

(false)
If set to true, Kuzzle will wait for the persistence layer to finish indexing

documents #

Each document has the following properties:

Arguments Type Description
_id
String
Document ID
body
Map<String, dynamic>
Document body

Return #

A Map<String, dynamic> which has a successes and errors: Each created document is an object of the successes array with the following properties:

Property Type Description
_source
Map<String, dynamic>
Updated document
_id
String
ID of the updated document
_version
int
Version of the document in the persistent data storage

Each errored document is an object of the errors array with the following properties:

Property Type Description
document
Map<String, dynamic>
Document that causes the error
status
int
HTTP error status
reason
int
Human readable reason

Usage #

Copied to clipboard!
final result = await kuzzle
  .document
  .mUpdate('nyc-open-data', 'yellow-taxi', [
    {
      '_id': 'some-id',
      'body': {
        'name': 'Smith'
      }
    }, 
    {
      '_id': 'some-id2',
      'body': {
        'name': 'Freeman'
      }
    }
  ]);