Wednesday, 21 August 2013

Cannot remove on mongodb using mongoose?

Cannot remove on mongodb using mongoose?

Hi im trying to simply remove a document from a collection using mongoose
but for some strange reason I cannot get it to work.
Here is the code:
function deleteUserevent()
{console.log('in delete User Event');
models.Userevent.remove({ _id: "5214f4050acb53fe31000004"},
function(err) {
if (!err){
console.log('deleted user event!');
}
else {
console.log('error');
}
});
}
Can anyone help me out on my syntax? I know the _id is stored as new
ObjectId("5214f4050acb53fe31000004") but I have tried this with no joy?
Thanks.

No comments:

Post a Comment