Core
Framework v2.x
2

delete() #

Deletes a document.

Arguments #

Copied to clipboard!
delete (id: string, options?: JSONObject): Promise<JSONObject>;

Arguments Type Description
id
string
Document unique identifier
options
JSONObject
Optional arguments

options #

The options argument accepts the following parameters:

Options Type Description
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 #

Copied to clipboard!
await repository.delete('someDocumentId');

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