mimani/mongoose-diff-history

View on GitHub
diffHistoryModel.js

Summary

Maintainability
A
0 mins
Test Coverage
const mongoose = require('mongoose');
const { Schema } = mongoose;

const historySchema = new Schema(
    {
        collectionName: String,
        collectionId: Schema.Types.ObjectId,
        diff: {},
        user: {},
        reason: String,
        version: { type: Number, min: 0 }
    },
    {
        timestamps: true
    }
);

module.exports = { model: mongoose.model('History', historySchema) };