-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-source-mongodb): work with _id types that are not ObjectIds #16331
fix(gatsby-source-mongodb): work with _id types that are not ObjectIds #16331
Conversation
11cb860
to
cc2b92a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate that Mongo supports arbitrary data types for _id
but this seems like a fair change to handle edge cases like those.
Thank you for patching this @senorpedro 👍
Using mongodb, it is possible to use arbritary values (e.g. strings) as _id. In that case the current implementation will throw "TypeError: _id.toHexString is not a function" This fix will prevent this, at least for string _ids.
60b7d07
to
26ec339
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Holy buckets, @senorpedro — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
You're welcome! Thanks for creating such awesome software! :-) |
Description
Using mongodb, it is possible to use arbritary values (e.g. strings) as _id.
In that case the current implementation will throw
"TypeError: _id.toHexString is not a function"
This fix will prevent this, at least for string _ids.