UNPKG

mongoose-audit-trail

Version:

Manage Mongo Collection diff History and versions

20 lines (17 loc) 389 B
const mongoose = require("mongoose"); const { Schema } = mongoose; const historySchema = new Schema( { collectionName: String, collectionId: Schema.Types.ObjectId, method: String, diff: {}, user: {}, reason: String, version: { type: Number, min: 0 } }, { timestamps: true } ); module.exports = { model: mongoose.model("History", historySchema) };