SDK
SDK Dart Null Safety v3.x
2

replace #

Replaces the content of an existing document.


Arguments #

Future<Map<String, dynamic>> replace(
    String index,
    String collection,
    String id,
    Map<String, dynamic> document,
    { bool waitForRefresh = false, })
ArgumentsTypeDescription
index
String
Index
collection
String
Collection
id
String
Document ID
document
Map<String, dynamic>
New content of the document to update
waitForRefresh
bool

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

Return #

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

PropertyTypeDescription
_source
Map<String, dynamic>
Document content
_id
String
ID of the document
_version
int
Version of the document in the persistent data storage

Usage #

final result = await kuzzle
  .document
  .replace('nyc-open-data', 'yellow-taxi', 'some-id', {
    'firstname': 'John',
  });