DAB
Search…
remove
1
remove (id, params)
Copied!

Arguments

ID (required)

The document ID.

Params (required, mixed)

A plain javascript object of:
  • collection: Required, the name of collection you want to work with.
  • withSource: If you want to get the related document before deleted, set it to true. The document will be put under source key. Optional, defaults to false
Or, you're also allowed to pass a string. In this case, it will be interpreted as the collection name.

Response

Result

It should return an object like the one below:
1
{
2
success: true
3
}
Copied!
And with withSource set to true:
1
{
2
success: true,
3
source: {
4
_id: 'james-bond',
5
name: 'James Bond',
6
age: 40
7
...
8
}
9
}
Copied!

Error

If no document found, it'll yield Document not found error.
Any other error will yield a normal Node error object you can catch through promise easily.
Last modified 3yr ago