delete()
#
Deletes a document.
Arguments #
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 #
await repository.delete('someDocumentId');
/*
* { found: true,
* _index: '%<plugin name>',
* _type: '<collection>',
* _id: 'someDocumentId',
* _version: 3,
* result: 'deleted',
* _shards: { total: 2, successful: 1, failed: 0 }
* }
*/
Edit this page on Github(opens new window)