k-mongoose-soft-delete

1.2.2 • Public • Published

k-mongoose-soft-delete

An advanced package for softdeleting models with mongoose (also 'find', 'findOne', 'findOneAndUpdate', 'update', 'count')

TODO: Pending add more checks, test and documentation

Installation

The best way to install it is using npm

npm install k-mongoose-soft-delete --save

Loading

var softDelete = require('k-mongoose-soft-delete');
 

Initialization and Usage

Basic usage (you can see how works better with test:

mongoose.connect('mongodb://localhost/k-mongoose-soft-delete');
 
Resource = new mongoose.Schema({
    title: {type: String},
    second: {type: String, soft_delete_action: 'null'},
    third:  {type: String, soft_delete_action: 'prefix'}
},{timestamps:true});
 
Resource.plugin(softDelete);
 
//When you have a resource
resource.softDelete(function(err){});
 

Support

This plugin is proudly supported by Kubide hi@kubide.es

Package Sidebar

Install

npm i k-mongoose-soft-delete

Weekly Downloads

6

Version

1.2.2

License

MIT

Unpacked Size

16.1 kB

Total Files

13

Last publish

Collaborators

  • dev.kubide
  • gelito
  • jolorenzom