mongoose-updated-at
v1.0.2
Published
Adds an updatedAt timestamp property to your mongoose model
Downloads
8
Readme
mongoose-updated-at
Another mongoose updated-at module. Gives you some options to change the path and indexing object.
npm install --save mongoose-updated-at
Usage
'use strict';
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var MySchema = new Schema({
name: String
});
MySchema.plugin(require('mongoose-updated-at'));
To pass in options:
MySchema.plugin(require('mongoose-updated-at'), {
updatedAtPath: 'updatedAt',
index: false
});
Options
updatedAtPath
(String) - The path to add the updatedAt property. Default:'updatedAt'
index
(Mixed) - The indexing options given to this field. See http://mongoosejs.com/docs/api.html#schematype_SchemaType-index. Default:false