createOrReplace method

Future<Map<String, dynamic>> createOrReplace(
  1. String index,
  2. String collection,
  3. String id,
  4. Map<String, dynamic> document, {
  5. bool waitForRefresh = false,
})

Creates a new document in the persistent data storage, or replaces its content if it already exists.

Implementation

Future<Map<String, dynamic>> createOrReplace(
  String index,
  String collection,
  String id,
  Map<String, dynamic> document, {
  bool waitForRefresh = false,
}) async {
  final response = await kuzzle.query(KuzzleRequest(
    controller: name,
    action: 'createOrReplace',
    index: index,
    collection: collection,
    uid: id,
    body: document,
    waitForRefresh: waitForRefresh,
  ));

  return response.result as Map<String, dynamic>;
}