mongoose-timestamp
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -8,4 +8,3 @@ /*! | ||
var mongoose = require('mongoose'); | ||
var BinaryParser = require('mongoose/node_modules/mongodb/node_modules/bson').BinaryParser; | ||
var BinaryParser = require('bson').BinaryParser; | ||
@@ -20,4 +19,3 @@ function timestampsPlugin(schema, options) { | ||
if (this._createdAt) return this._createdAt; | ||
var unixtime = BinaryParser.decodeInt(this._id.id.slice(0, 4), 32, true, true); | ||
return this._createdAt = new Date(unixtime * 1000); | ||
return this._createdAt = this._id.getTimestamp(); | ||
}); | ||
@@ -24,0 +22,0 @@ schema.pre('save', function (next) { |
{ | ||
"name": "mongoose-timestamp" | ||
, "description": "Mongoose plugin that adds createdAt and updatedAt auto-assigned date properties" | ||
, "version": "0.1.0" | ||
, "version": "0.1.1" | ||
, "author": "Nicholas Penree <nick@penree.com>" | ||
@@ -12,6 +12,7 @@ , "keywords": ["mongodb", "mongoose", "plugin", "timestamps", "createdAt", "updatedAt"] | ||
, "dependencies": { | ||
"mongoose": ">= 3.0" | ||
"bson": "0.2.2" | ||
} | ||
, "devDependencies": { | ||
"should": ">= 0.2.1" | ||
"mongoose": ">= 3.0" | ||
, "should": ">= 0.2.1" | ||
, "mocha": ">= 0.13.0" | ||
@@ -26,2 +27,2 @@ } | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
Mongoose Timestamps Plugin | ||
Mongoose Timestamps Plugin [![Build Status](https://secure.travis-ci.org/drudge/mongoose-timestamp.png?branch=master)](https://travis-ci.org/drudge/mongoose-timestamp) | ||
========================== | ||
@@ -3,0 +3,0 @@ |
6936
3
84
+ Addedbson@0.2.2
+ Addedbson@0.2.2(transitive)
- Removedmongoose@>= 3.0
- Removed@mongodb-js/saslprep@1.1.9(transitive)
- Removed@types/webidl-conversions@7.0.3(transitive)
- Removed@types/whatwg-url@11.0.5(transitive)
- Removedbson@6.10.1(transitive)
- Removeddebug@4.4.0(transitive)
- Removedkareem@2.6.3(transitive)
- Removedmemory-pager@1.5.0(transitive)
- Removedmongodb@6.12.0(transitive)
- Removedmongodb-connection-string-url@3.0.2(transitive)
- Removedmongoose@8.9.5(transitive)
- Removedmpath@0.9.0(transitive)
- Removedmquery@5.0.0(transitive)
- Removedms@2.1.3(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedsift@17.1.3(transitive)
- Removedsparse-bitfield@3.0.3(transitive)
- Removedtr46@5.0.0(transitive)
- Removedwebidl-conversions@7.0.0(transitive)
- Removedwhatwg-url@14.1.0(transitive)