SDK
SDK Dart v2.x
2

replace #

Replaces the content of an existing document.


Arguments #

Copied to clipboard!
Future<Map<String, dynamic>> replace(
    String index,
    String collection,
    String id,
    Map<String, dynamic> document,
    { bool waitForRefresh = false, })
Arguments Type Description
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:

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

Usage #

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