cdimascio / uuid-mongodb

📇 Generates and parses MongoDB BSON UUIDs
MIT License
101 stars 17 forks source link

MUUID.from() fails with CastError #52

Open TisRyno opened 3 years ago

TisRyno commented 3 years ago

v2.4.3 introduces: CastError: Cast to Buffer failed for value "new Binary(Buffer.from("bd8b82fd91604ebc8010f5026c0b1644", "hex"), 4)" at path "centre" for model "Queue"

The code where it fails is as simple as:

const rows = await MQueue.find({
    centre: MUUID.from(uuid),
    deletedAt: null
})

I can confirm that reverting to v2.4.2 fixes the issue

xairoo commented 3 years ago

I have this problem with mongoose 6.0.5. Working with 5.12.2.

uuid-mongodb 2.4.2 doesn't fix this.

So... npm i mongoose@5.12.2 ;-)