Closed panosru closed 12 years ago
Ok, as I saw it uses a useVirtual
option in order to provide the created time based from _id but how I can I access that?
ok nvm I did a horible mistake :P
I was passing the document through json and then I tried to access the virtual field from the json object, which obvisly faild :P
@panosru you can pass virtuals in mongoose (such as the created) with doc.toObject({ /* getters: true, */ virtuals: true })
and then stringify the object or you can change the timestamp plugin so it doesn't use virtuals with mySchema.plugin(troop.timestamp, { useVirtual: false })
-- but with this second option you'll be storing the created time data twice when you dont need to.
@tblobaum oh I didn't knew about this! Thanks a lot! :) :)
Hello I try to use the
timestamp
plugin but onlymodified
field is created thecreated
time field is not... any idea?