June 2015
Intermediate to advanced
192 pages
4h 8m
English
At some point, you may want to delete a document in a collection using Node.js.
You do this using the remove method, which removes matching documents from the collection you specify. Here's an example of how to call remove:
var remove = function(collection, callback) {
collection.remove({ call: 'kf6gpe-7'},
function(error, result)
{
console.log('remove returned ' + error);
console.log(result);
callback(result);
});
};This code removes documents that have a call field with the value kf6gpe-7. As you may have guessed, the search criteria used for remove can be anything you'd pass to find. The remove method removes all documents matching your search criteria, so be careful! Calling ...
Read now
Unlock full access