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

Unsupported BSON version, bson types must be from bson 5.0 or later when used with mongoose 7.0.0 #349

Open
Fasunle opened this issue Mar 4, 2023 · 7 comments

Comments

@Fasunle
Copy link

Fasunle commented Mar 4, 2023

  • work around for now is to downgrade mongoose version to 6.6.2
  • I tried to install latest bson package (5.0.1) as a peer dependency, but this does not fix the problem

Reproduce Bug

In order to reproduce this bug, use mongo-cursor-pagination (8.1.2 or 8.1.3) with mongoose (7.0.0).

The error occurs whenever next page query is added to paginate function.

@Fasunle
Copy link
Author

Fasunle commented Mar 4, 2023

Please, let me know if you need any further information to help you solve this bug

@KDDeveloper
Copy link

I dont have a solution to it but, I had updated my mongo server which cleared my DB and collections, as soon as imported them again the error went away.

@Fasunle
Copy link
Author

Fasunle commented Mar 24, 2023

So, it means it could be that my mongo server is obsolete. Interesting! I will try upgrading and see how it goes.

@KDDeveloper
Copy link

I faced the same error second time again, this was due to using an older version of mongoose(5.1.1) to create a new Objectid, updating it to v 7.0.3 resolved the issue. If someone could explain why does this error occur that would be awesome. All the best

@truthseekers
Copy link

truthseekers commented Mar 25, 2023

I'm having the same problem. Followed @KDDeveloper 's suggestion and now I'm just getting "null" for ids. I'm using GraphQL and most of the time it's smart enough to convert _id to id, but now I have to do it manually.

I also had to upgrade to MongoDB 6.0 to fix the BSON types error. Deleting and re-adding collections did not fix the issue.

@wvkehoe
Copy link

wvkehoe commented Apr 5, 2023

I was able to work-around this issue by forcing newer BSON and mongodb versions using this in my project's package.json file:
"overrides": { "mongoose": { "mongodb": "5.2.0", "bson": "5.2.0" }, "mongo-cursor-pagination": { "mongodb": "5.2.0", "bson": "5.2.0" } }

@alexperry870
Copy link

work around:

"resolutions": { "bson": "6.8.0", "mongo-cursor-pagination/bson": "6.8.0", "mongodb/bson": "6.8.0", "mongoose/mongodb/bson": "6.8.0" }

I will try to fix it with a PR.

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

5 participants