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

ObjectId is incorrectly converted into string by $group #43

Open
bpiltz opened this issue Feb 17, 2017 · 0 comments
Open

ObjectId is incorrectly converted into string by $group #43

bpiltz opened this issue Feb 17, 2017 · 0 comments

Comments

@bpiltz
Copy link

bpiltz commented Feb 17, 2017

When returning a field containing an ObjectId the returned Object does not contain a valid id-String. When console.logging the direct result on the server the id is not put into ''. So it is actually a hex-number. Obviously the conversion into a string is not done correctly as the resulting string is a direct byte-to-ascii conversion which results in wired characters within the string. It can be corrected by iterating over the result and performing a byte-by-byte 'charCodeAt'-conversion (with zero-padding for numbers < 0x10). Using [email protected].

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

1 participant