Created: 2014-05-18 19:59
Updated: 2016-10-13 14:04
License: mit

Mongoose paranoid_remove Plugin

A simple Mongoose plugin which adds deletedAt date attribute to models that include our plugin.


npm install mongoose-paranoid_remove --save


Then require mongoose-paranoid_remove plugin on your schema file.

var removedTimestamp = require('mongoose-paranoid_remove');

var UserSchema = new Schema({
    name: String


module.exports = mongoose.model('User', UserSchema);

Useful methods provided by paranoid_remove:

user.paranoid_remove(); Updates user.deletedAt, use it instead of calling the usual remove middleware.

	// users DESTROY action
	.delete(function(req, res) {

		User.findById(req.params.user_id, function(err, user) {
			if (err) res.send(err);

			user.paranoid_remove(); {
				if (err) res.send(err);

				res.json({ message: 'User deleted!' });


User.undeleted(err, users); Retrieves documents that have not been "removed".

  // users INDEX action
  .get(function(req, res) {

    User.undeleted(function(err, users) {
      if (err) res.send(err);


Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more