Skip to content

ID's being converted to scientific notation #1748

@GlennMurphy

Description

@GlennMurphy

As mongo's generated ID's get larger loopback seems to convert mongo's auto generated ID's to scientific notation integers instead of keeping them as strings.

For instance. I have a document with the auto generated ID "562547717371313000366169"

If I request document via the endpoint:

/documents/562547717371313000366169

Loopback returns that it can not find the model. I hooked this call with the 'access' hook and logged the where query.

query:
{
where: { id: 5.62547717371313e+23 },
limit: 1,
offset: 0,
skip: 0,
}

I can get around this by querying documents with the following URL:

/documents?filter={"where":{"id":"562547717371313000366169"}}

But now I can't use any of the generated endpoints for the item.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions