Closed paul-ley closed 7 years ago
In your code, documentSchema
is a plain object, not an instance of a mongoose.Schema
object. Try:
var timestamps = require('mongoose-timestamp');
var mongoose = require("mongoose");
var Schema = mongoose.Schema;
var documentSchema = new Schema({
name: String,
isPayed: { type: Boolean, default: false }
});
documentSchema.plugin(timestamps);
module.exports = mongoose.model('documents', documentSchema);
did an npm install mongoose-timestamp, implemented the plugin, as follows:
When starting node, the compiler returns folliowing error: