-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_id no longer recursive when another version of bson in installed #15140
Comments
Can you please provide some code samples that demonstrate this issue? |
Attached is a simple project which creates a document in db, finds it, then logs doc._id._id steps to reproduce the bug : yarn install
# logs an _id
yarn start
yarn add [email protected]
# logs undefined
yarn start
yarn add [email protected]
# logs an _id
yarn start |
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days |
@vkarpov15 do you think this is a mongoose bug ? or the issue should be closed ? |
Sorry for letting this issue get stale, we'll review this next week. |
No problem, thanks ! |
This issue isn't just limited to yarn, npm also similarly doesn't dedupe packages when the top-level version of bson is different. Here's my
With However, you're right that this behavior is unexpected and tricky to debug. We will take a closer look at #15154, which suggests Mongoose removing bson as a top-level dependency and just depending on the MongoDB Node driver. |
On the project I am working on, with When installing In this state, running On the project I attached with my previous post, with I don't know what to think, I guess I'm missing something... |
All very strange. I think the correct solution will be #15154, but that will take some time for us to implement. |
Prerequisites
Mongoose version
8.9.1
Node.js version
20.7.0
MongoDB server version
8.0.1
Typescript version (if applicable)
No response
Description
I experienced something quite similar to this closed issue #14867
Following a mongoose update (8.9.1) in my project (with yarn) without any problem, for whatever reason I decided to delete the yarn.lock file to regenerate it, and encountered the issue described by @gl-aagostino
The recursiveness worked when creating an ObjectId in code, but fails when loading a document from the db
Turns out this version of mongoose uses [email protected], and [email protected] was also in my package.json
Updating bson to 6.10.1 resolved the problem
Not sure if it's a yarn, mongoose or bson issue, but couldn't find talks about this anywhere else
Steps to Reproduce
create a project with [email protected] and [email protected]
insert a doc in db and find it
doc._id._id should crash
Expected Behavior
doc._id._id should not crash
The text was updated successfully, but these errors were encountered: