A Mongoose Plugin which stores changes in json-patch format
npm install mongoose-json-patch-historyThis plugin saves a history of all changes in the json-patch format
bash
npm install mongoose-json-patch-history --save
`Usage
`javascript
const mongoose = require('mongoose');
const history = require('mongoose-json-patch-history');var schema = mongoose.Schema({
name: String,
...
});
schema.use(history);
`API
$3
#### store(): Promise\
Stores a new history entry.
Note: This gets called on pre save hook#### retrieve(): Promise\
Returns all history entries for this document
#### clear(): Promise\<>
Clears the History of this document
$3
Applies the patches and saves the modified document.$3
The History Collection for the current modelOptions
| Option | Type | Default Value | Description |
|-----------|--------------------|---------------------------------------------------------|---------------|
| database | Mongoose Connection | mongoose` | The Database the document should connect to |