GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — @google-cloud/datastore 0.5.0 does not return entity keys with query results · Issue #250 · GoogleCloudPlatform/nodejs-docs-samples

@google-cloud/datastore 0.5.0 does not return entity keys with query results #250

New issue
Copy link
New issue
Copy link
Closed
Closed
@google-cloud/datastore 0.5.0 does not return entity keys with query results#250
Copy link
Labels
🚨This issue needs some love.triage meI really want to be triaged.

Description

@stephenplusplus
stephenplusplus
opened on Nov 9, 2016
Issue body actions

From @floodfx on November 9, 2016 16:40

Environment details

  • OS: MacOS 10.11.6
  • Node.js version: 6.9.1
  • npm version: 3.10.8
  • google-cloud-node version: 0.43.0
  • @google-cloud/datastore version: 0.5.0

Steps to reproduce

git clone [email protected]:GoogleCloudPlatform/nodejs-docs-samples.git
cd nodejs-docs-samples/datastore

Open quickstart.js
Add code below to end of the file

// query for entities
var q = datastoreClient.createQuery(kind)
q.run((err, entities, nextQuery) => {
  console.log(err, entities, nextQuery)
  for(var i = 0; i < entities.length; i++) {
    var task = entities[i];
    console.log(`Task ${task}: Key${task.key}`);
  }
});

Run

npm install
node quickstart.js

Keys returned with entity results.

Next update package.json to use 0.5.0 of @google-cloud/datastore

Run

node quickstart.js

Keys are "undefined".

Copied from original issue: googleapis/google-cloud-node#1780

Activity

Next
  1. stephenplusplus commented on Nov 9, 2016

    @stephenplusplus
    stephenplusplus
    on Nov 9, 2016
    ContributorAuthor
    More actions

    From @floodfx on November 9, 2016 16:42

    Note the default version of @google-cloud/datastore for nodejs-docs-samples is "^0.1.1"

  2. stephenplusplus commented on Nov 9, 2016

    @stephenplusplus
    stephenplusplus
    on Nov 9, 2016
    ContributorAuthor
    More actions

    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.

  3. floodfx commented on Nov 9, 2016

    @floodfx
    floodfx
    on Nov 9, 2016
    More actions

    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?

  4. stephenplusplus commented on Nov 9, 2016

    @stephenplusplus
    stephenplusplus
    on Nov 9, 2016
    ContributorAuthor
    More actions

    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!

  5. jmdobry commented on Nov 9, 2016

    @jmdobry
    jmdobry
    on Nov 9, 2016
    Member
    More actions

    I actually just fixed all of the Datastore samples in this repo to use 0.5.0, the PR is pending review: #249

  6. jmdobry
    added 2 commits that reference this issue on Nov 18, 2016

    Fixes #48

    This issue will close once commit dbb186a is merged into the 'main' branch.
    dbb186a

    Fixes #48

    This issue will close once commit ed81bc1 is merged into the 'main' branch.
    ed81bc1
  7. jmdobry
    closed this as completedin 1b3dd3fon Nov 21, 2016
  8. puppetmaster3 commented on Feb 28, 2017

    @puppetmaster3
    puppetmaster3
    on Feb 28, 2017
    More actions

    Does not work, I tried the new way, and you can't get the key back via query.

  9. czzarr commented on Mar 2, 2017

    @czzarr
    czzarr
    on Mar 2, 2017
    More actions

    How do you get the key on the front-end without the datastore dependency?

  10. yoshi-automation
    added
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Apr 7, 2020
  11. kweinmeister
    added 3 commits that reference this issue on Nov 7, 2022

    chore(main): release 3.0.3 (#250)

    8504a3a

    chore(main): release 3.0.3 (#250)

    ca62be6

    chore(main): release 3.0.3 (#250)

    2f659cb
  12. 5 remaining items

  13. NimJay
    added a commit that references this issue on Nov 10, 2022

    Fixes #48 (#249)

    This issue will close once commit 5036529 is merged into the 'main' branch.
    5036529
  14. ace-n
    added 3 commits that reference this issue on Nov 10, 2022

    migrate code from googleapis/nodejs-cloudbuild (#2824)

    f03f09a

    chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 (#…

    2b77145

    chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 (#…

    c59403d
  15. ahrarmonsur
    added 2 commits that reference this issue on Nov 16, 2022

    feat!: converts library to TypeScript adding v1p1beta1 surface (#250)

    e4684b0

    feat!: converts library to TypeScript adding v1p1beta1 surface (#250)

    49155e9
  16. ace-n
    added a commit that references this issue on Nov 16, 2022

    chore: release 2.1.0 (#250)

    018dc3f
  17. ahrarmonsur
    added 3 commits that reference this issue on Nov 16, 2022

    feat!: converts library to TypeScript adding v1p1beta1 surface (#250)

    3d62401

    feat!: converts library to TypeScript adding v1p1beta1 surface (#250)

    33cab6d

    feat!: converts library to TypeScript adding v1p1beta1 surface (#250)

    cea35bd
  18. ace-n
    added 2 commits that reference this issue on Nov 17, 2022

    chore: release 2.1.0 (#250)

    50a9627

    feat!: converts library to TypeScript adding v1p1beta1 surface (#250)

    2ee2b8e
  19. ahrarmonsur
    added a commit that references this issue on Nov 17, 2022

    chore: release 2.1.0 (#250)

    68a9815
  20. NimJay
    added 2 commits that reference this issue on Nov 18, 2022

    chore: release 2.3.1 (#250)

    d44cf19

    chore: release 2.3.1 (#250)

    dfd5d1a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.triage meI really want to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.