drudge / mongoose-timestamp

Adds createdAt and updatedAt date attributes that get auto-assigned to the most recent create/update timestamp
Other
308 stars 64 forks source link

Adding options for user schema.virtual('createdAt').set #1

Closed nuxlli closed 11 years ago

nuxlli commented 11 years ago

Hi,

In some cases it may be necessary specify the date of creation object. I think this may be not a requirement for all, for that reason I implemented a small option:

mongoose.plugin(timestamps, { enableCreatedSet: true })

This became really useful to me in time to manipulate dates in tests. I hope it's useful for more people.

nuxlli commented 11 years ago

Hi,

Sorry, I was stupid in my implementation, I did not realize that the method does not use a virtual field createdAt in the database only the information extracted from id.

Please ingnore my pull request.