Skip to content

[BUG] Sometimes, Key element in Datastore is parsed as id  #874

Description

@dg3feiko

Env

Node: 2.3.3
gcloud: 0.21.0

Problem

dataset.key(['Tracking2', "556ba07cbeb676ba7e9458e8"]) => key path: name =556ba07cbeb676ba7e9458e8
but
dataset.key(['Tracking2', "55479506996815820615e988"]) => key path: id=-9204792730274402000

Root cause

https://github.com/GoogleCloudPlatform/gcloud-node/blob/master/lib/datastore/entity.js#L227

> isNaN("556ba07cbeb676ba7e9458e8")
true
> isNaN("55479506996815820615e988")
false

explain: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/isNaN#Description

Activity

  1. jgeewax commented on Sep 20, 2015

    @jgeewax
    Contributor
  2. stephenplusplus commented on Sep 20, 2015

    @stephenplusplus
    Contributor

    Very nice! A PR is welcome to use is.number instead, otherwise someone will jump on this soon. Thanks for reporting!

  3. added
    api: datastoreIssues related to the Datastore API.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Sep 20, 2015
  4. 1 remaining item

  5. added a commit that references this issue on Mar 5, 2026
  6. added a commit that references this issue on Mar 11, 2026
  7. added a commit that references this issue on Mar 27, 2026
  8. added a commit that references this issue on Mar 27, 2026
  9. added a commit that references this issue on May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: datastoreIssues related to the Datastore API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions