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

MongoClient stores IDs as string #114

Closed
DieterDePaepe opened this issue Aug 27, 2017 · 1 comment
Closed

MongoClient stores IDs as string #114

DieterDePaepe opened this issue Aug 27, 2017 · 1 comment
Labels

Comments

@DieterDePaepe
Copy link

Mongoclient stores the _id field as a string rather than an ObjectId when useObjectId == false (default value).

This behavior was introduced in the pull request for issue #36. See JsonObjectCodec#generateIdIfAbsentFromDocument.

The main issue caused by this is that not all commands (can) ensure this behavior, eg: updateWithOptions, when used as an upsert, will create an ObjectId - see #97 - resulting in multiple id representations in the DB.
An additional disadvantage is that using string values for _id requires more storage space per document than an ObjectId.

@karianna
Copy link
Contributor

@DieterDePaepe We've taken a look and agree that #97 is a bug and have put a help wanted label on that. Hopefully a community contributor fixes it in the holiday break. Please open more issues if you find that useObjectId is not being honoured elsewhere.

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

No branches or pull requests

3 participants