Closed thxmike closed 6 years ago
As i'm unable to reply on stack i'm writing it here. Try to use mongoose v4 not v5. I had similar problem on new release.
OK Checking Mongoose v4
I checked using Mongoose v4. This was a problem since v4 does not support the ES6 constructs and fails on LoadClass.
@thxmike replied to your post on stack: https://stackoverflow.com/a/48663223/1714542
The problem is here https://github.com/niahmiah/mongoose-uuid/blob/bfa1b5ad3536b067cac19456eabac2af64beac86/index.js#L100
It occurs when your major version of mongoose
differs from the mongoose-uuid
's one.
I ended up creating a fork of this repo and updated the bson and mongoose packages. https://github.com/thxmike/mongoose-uuid. I then updated the code to the use the new bson contracts in the naming of the types. I understand why are limited to doing it this way. Basically it is for backwards compatibility. I attempted to pull request this into the repo but since you support the node 0.10, it fails due to mongoose using ES6 construct. I will use my forked version until I can spend more time on this for an alternate solution.
Thanks thxmike!
I documented this problem https://stackoverflow.com/questions/48491035/mongoose-does-not-return-id-in-findone?noredirect=1#comment83977280_48491035
It works great with instances of the model (document) however, when I do a find on an object, the returned object returns from the database but fails to push _id into the schema and states Could not cast �*.��F����G�U` to uuid
Not sure how to fix this one.