O'Reilly logo
  • Patrick S thinks this is interesting:

The remove() method can be used in two ways: as a model method, or as an instance method. When using it as a model method, you pass it a query object and it will remove the matching documents. For example:

User.remove({ name : /Simon/ } , function (err){
  if (!err){
    // all users with 'Simon' in their name were deleted

To use the remove() method as an instance method you operate it after a find operation once you have results returned. For example:



Cover of Mongoose for Application Development


using remove() as instance or model method