Skip to content
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

Mongoose v6 ObjectId deepEqual always true #1470

Open
spaiz opened this issue Jun 13, 2022 · 3 comments
Open

Mongoose v6 ObjectId deepEqual always true #1470

spaiz opened this issue Jun 13, 2022 · 3 comments

Comments

@spaiz
Copy link

spaiz commented Jun 13, 2022

Hi. We did pay attention in our tests that we cannot rely anymore on deep.equal when comparing objects with ObjectId() or even ObjectIds itself.

Env: node v16
Mongoose version: v5 vs v6

For the mongoose v5 tests work as expected.

{
  "dependencies": {
    "chai": "^4.3.6",
    "mocha": "^10.0.0",
    "mongoose": "^5.0.0"
  }
}

Screen Shot 2022-06-13 at 13 42 38

For mongoose v6 tests are passing when they should fail.

{
  "dependencies": {
    "chai": "^4.3.6",
    "mocha": "^10.0.0",
    "mongoose": "^6.0.0"
  }
}

Screen Shot 2022-06-13 at 13 41 55

I did prepare a repo for reproducing the issue: https://github.com/spaiz/objectId_tests

@spaiz
Copy link
Author

spaiz commented Jun 21, 2022

I assume this PR should fix it :/

chaijs/deep-eql#86

@leyb-guesty
Copy link

hi
any news on this?

@qstrahl
Copy link

qstrahl commented Oct 21, 2024

I believe this issue has been fixed, at least as of the latest version in the 7.x branch - possibly earlier. @spaiz @leyb-guesty can you confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants