Core
Framework v2.x
2

delete() #

Deletes a document.

Arguments #

delete (id: string, options?: JSONObject): Promise<JSONObject>;

ArgumentsTypeDescription
id
string
Document unique identifier
options
JSONObject
Optional arguments

options #

The options argument accepts the following parameters:

OptionsTypeDescription
refresh
string
If set with the wait_for string value, then the function will respond only after the document has been indexed

Return #

The delete function returns a promise, resolving to the document deletion result.

Example #

await repository.delete('someDocumentId');

/*
  *  { found: true,
  *    _index: '%<plugin name>',
  *    _type: '<collection>',
  *    _id: 'someDocumentId',
  *    _version: 3,
  *    result: 'deleted',
  *    _shards: { total: 2, successful: 1, failed: 0 }
  *  }
  */