How can I get data with key

2 views
Skip to first unread message

JinHyung Kim via StackOverflow

unread,
May 9, 2017, 11:48:09 PM5/9/17
to gcd-stac...@googlegroups.com

i answer my self

need datastoreClient.int(_id)

let query = datastoreClient.createQuery(keyName)
  .hasAncestor(datastoreClient.key([keyName, datastoreClient.int(_id)]))


Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/43882618/how-can-i-get-data-with-key/43883259#43883259

Dan McGrath via StackOverflow

unread,
May 10, 2017, 3:23:07 PM5/10/17
to gcd-stac...@googlegroups.com

Rather than doing a query, you should do a direct get on the entity.

var key = datastoreClient.key(['item', datastore.int('123124124234221')]);
datastoreClient.get(key, function(err, entity) {
  console.log(err || entity);
});


Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/43882618/how-can-i-get-data-with-key/43901028#43901028
Reply all
Reply to author
Forward
0 new messages