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

can you override the dates? (to manually set them) #21

Closed kidbrax closed 10 years ago

kidbrax commented 10 years ago

I have a situation where I am migrating some data and would like to preserve the modified dates from the original record. Can I manually set the created/modified dates and then have mongoose-timestamp skip its action so they are preserved?

drudge commented 10 years ago

If you're using mongoose to migrate, just don't use the plugin until the data is already in the database. The purpose of the plugin is to add/update the dates on save.

kidbrax commented 10 years ago

I'll take that as a no. I am migrating our data through an existing api that uses the mongoose-timestamp plugin. I'll try to work on an option and submit a pull-request.