mongoose-update-document-version
v1.0.2
Published
Plugin for mongoose to auto increment document version on update any document
Downloads
16
Maintainers
Readme
mongoose-update-document-version
Plugin for mongoose to auto increment document version on update any document
Usage:
Import at JavaScript
const mongooseUpdateDocumentVersion = require('mongoose-update-document-version');
or TypeScript
import * as mongooseUpdateDocumentVersion from 'mongoose-update-document-version';
To used at specified schema
const mongoose = require('mongoose');
const PersonSchema = new mongoose.Schema({
// ...
})
// Add plugin to your schema
PersonSchema.plugin(mongooseUpdateDocumentVersion);
To used for all mongoose Schemas
const mongoose = require('mongoose');
// Add plugin to global mongoose
mongoose.plugin(mongooseUpdateDocumentVersion);