Repository navigation
@google-cloud/datastore 0.5.0 does not return entity keys with query results #250
Description
Activity
From @floodfx on November 9, 2016 16:42
Note the default version of @google-cloud/datastore for nodejs-docs-samples is "^0.1.1"
Thanks for reporting, @floodfx!
An entity structures its data differently now, not embedding the Key within the object:
datastore.get(key, function(error, entity) { // Before: entity.key = Key object entity.data = {...data...} // After: entity = {...data...} entity[datastore.KEY] = Key object });
See googleapis/google-cloud-node#1768 for more details.
Thanks @stephenplusplus. appreciate the link. figured I was missing something obvious. Do you know where this is mentioned in the official docs? I spent a lot of time trying to figure this out before trying a different version. Happy to send a PR on docs if that'd be helpful?
I'm really sorry about that :( I think we've caught all of the examples in the docs, but they won't update until we cut a new release. If you browse the master docs, you'll see the corrected examples.
Thank you very much for being patient and offering your help!
I actually just fixed all of the Datastore samples in this repo to use 0.5.0, the PR is pending review: #249
Does not work, I tried the new way, and you can't get the key back via query.
How do you get the key on the front-end without the
datastoredependency?- addedtriage meI really want to be triaged.I really want to be triaged.🚨This issue needs some love.This issue needs some love.
on Apr 7, 2020 5 remaining items
- added a commit that references this issue
on Nov 10, 2022 - added a commit that references this issue
on Nov 17, 2022 - added 2 commits that reference this issue
on Nov 18, 2022
From @floodfx on November 9, 2016 16:40
Environment details
Steps to reproduce
Open
quickstart.jsAdd code below to end of the file
Run
Keys returned with entity results.
Next update package.json to use 0.5.0 of @google-cloud/datastore
Run
Keys are "undefined".
Copied from original issue: googleapis/google-cloud-node#1780