node package manager
Loosely couple your services. Use Orgs to version and reuse your code. Create a free org ยป



Saves visible, non-virtual timestamps to Mongoose models. Intended as a replacement for mongoose-timestamp.


You can install mongoose-concrete-timestamps with npm:

npm install mongoose-concrete-timestamps

This module serves a simple purpose: write a createdAt timestamp on the first save(), and update the updatedAt timestamp on each save().


Using this module is super-simple. Just require the module:

var timestamps = require('mongoose-concrete-timestamps');

And plug it into your schema:

var userSchema = new mongoose.Schema({ name: String });
var User = mongoose.model('User', userSchema);

var user = new User({ name: "Foo" }); (err, user) {
  // user.createdAt will be set to, at the time of the save() call.
  // The same goes for user.updatedAt, except it's updated on each save().


To run the tests for this module, make sure you have mocha installed:

npm install -g mocha

Once installed, you can run the tests by invoking mocha from the project's root.