Skip to content

ObjectId is incorrectly converted into string by $group #43

@bpiltz

Description

@bpiltz

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].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions