How can i get data with key

2 views
Skip to first unread message

JinHyung Kim via StackOverflow

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

I want to find data with key from google datastore

in normal RDB

select * from items where key = '123124124234221' 

in GQL Query

SELECT * from items WHERE __key__ HAS ANCESTOR KEY(item, 123124124234221)

it works!

but in nodejs

let query = datastoreClient.createQuery('items')
  .hasAncestor(datastoreClient.key(['item', '123124124234221']))

datastoreClient.runQuery(query, (err, entity) => {
  if (err) { reject(err) }
  console.log(entity)
})

result is empty []

please help how to get a data with key in node.



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