Reputation: 1584
how to Remove given list of documents from mongodb collection? eg:
i want to remove list of students which name containing empty value like.
var list=db.Student.find({'Name': {$eq: ''}})
db.Student.update($pull:{list})
but its is not working. is there any other best solution for this?
Upvotes: 0
Views: 110
Reputation: 69
You can remove the documents with the given condition by passing a query document. Try this;
db.Student.remove( { Name : "" } )
You can refer this link for further clarifications. http://docs.mongodb.org/manual/tutorial/remove-documents/
Upvotes: 1