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

var History = mongoose.model("History", historySchema);
module.exports = History;
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 = mongoose.model('History', historySchema);

Clean up history model: ES6, DRY, simpler schema.
Clean up history model: ES6, DRY, simpler schema.
