Rapidfacture / mongoose-multi

NPM Module: Create Mongoose connections to severals DBs; short, mongoDB like syntax for requests.
12 stars 4 forks source link

schemas with timestamp enabled are not working #14

Open mergingseas opened 2 years ago

mergingseas commented 2 years ago

after creating a schema and then setting "timestamp: true" I get error when creating the document.

Screen Shot 2022-02-27 at 3 24 23 PM Screen Shot 2022-02-27 at 3 25 42 PM

FelixFurtmayr commented 2 years ago

Seems to me this is a problem with mongoose itself. Other people are experiencing also problems with additional options: https://stackoverflow.com/questions/63436981/mongoose-adding-subdocument-to-array-giving-error-id-this-ownerdocument-m

Would you try to install a newer mongoose version? If this fixes the problem, I can update it. However - I have become careful with updating mongoose as this can lead to problems - open new bugs that you did not know about ;-)

mergingseas commented 2 years ago

using timeslots:true doesn't seem to be an issue when using mongoose directy. I did upgrade to mongoose 6 which is the latest driver for the latest mongodb update to mongodb 5

thanks

mergingseas commented 2 years ago

this is my current workaround using mongoose-multi timestamps: { currentTime: () => new Date() }