SDK
SDK Dart Null Safety v3.x
2

update #

Updates a document.


Arguments #

Future<Map<String, dynamic>> update(
    String index,
    String collection,
    String id,
    Map<String, dynamic> document, {
    bool waitForRefresh = false,
    int retryOnConflict,
    bool source,
  })
ArgumentsTypeDescription
index
String
Index
collection
String
Collection
id
String
Document ID
document
Map<String, dynamic>
Partial document content
waitForRefresh
bool

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

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

(false)
If true, returns the updated document inside the response

Return #

A Map<String, dynamic> which has the following properties:

PropertyTypeDescription
_source
Map<String, dynamic>
Updated document (If source option set to true)
_id
String
ID of the updated document
_version
int
Version of the document in the persistent data storage

Usage #

final result = await kuzzle
  .document
  .update('nyc-open-data', 'yellow-taxi', 'some-id', {
    'name': 'Johnny'
  });