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 — datastore: Projection KeyOnly-Query unable to select `__key__` - property stay empty · Issue #2338 · googleapis/google-cloud-node

datastore: Projection KeyOnly-Query unable to select __key__ - property stay empty #2338

New issue
Copy link
New issue
Copy link
Closed
Closed
datastore: Projection KeyOnly-Query unable to select __key__ - property stay empty#2338
Copy link
Assignees
aweiher
Labels
api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.

Description

@aweiher
aweiher
opened on May 30, 2017
Issue body actions

Hello,

I try a really basic query, selecting the __key__ property - but it stays empty.

I searched the issues and stackoverflow, I also created a thread a SO, but it stays unanswered. I also created a ticket at the google cloud support, also no answer yet. Therefore I create this issue now.

Thread on stackoverflow:

  • https://stackoverflow.com/questions/44245132/property-key-is-empty-with-node

Environment details

  • OS: Linux (Ubuntu 16.04.1 LTS)
  • Node.js version: v7.3.0
  • npm version: 3.10.10
  • google-cloud-node version: 1.0.2

Steps to reproduce

const datastore = require('@google-cloud/datastore')({
  projectId: project,
  keyFilename: `key.json`
});

const query = datastore.createQuery("Projects").select('__key__');

datastore.runQuery(query, (err, entities, info) => {
  console.log('RESULTS:', {err, entities, info});
});

Result:

RESULTS: { err: null,
  entities: [ {}, {}, {}, {} ],
  info: 
   { moreResults: 'NO_MORE_RESULTS',
     endCursor: 'CjwSNmoOZX5zYW0tcmVjb3JkZXJyJAsSHF9BRV9EYXRhc3RvcmVBZG1pbl9PcGVyYXRpb24YwYQ9DBgAIAA=' } }

Expected Result:

RESULTS: { err: null,
  entities: [ 
      {___key___: 5634472569470976}, 
      {___key___: 5639445604728832}, 
      {___key___: 5654313976201216}, 
      {___key___: 5659313586569216} 
      ],
  info: 
   { moreResults: 'NO_MORE_RESULTS',
     endCursor: 'CjwSNmoOZX5zYW0tcmVjb3JkZXJyJAsSHF9BRV9EYXRhc3RvcmVBZG1pbl9PcGVyYXRpb24YwYQ9DBgAIAA=' } }

The property __key__ stays empty and I dont know why. Selecting an other property works as expected.

It should work as it is described in the API Docs: https://cloud.google.com/datastore/docs/concepts/queries#projection_queries

Do I missing something?

Thanks!

Activity

  1. aweiher
    changed the title [-]datastore: Projection KeyOnky-Query unable to select `__key__` - property stay empty[/-] [+]datastore: Projection KeyOnly-Query unable to select `__key__` - property stay empty[/+] on May 30, 2017
  2. aweiher commented on May 30, 2017

    @aweiher
    aweiher
    on May 30, 2017
    Author
    More actions

    ok, got an answer on SO - this seems to work:

    datastore.runQuery(query, (err, entities, info) => {
      const keys = entities.map( entity => entity[datastore.KEY] );
    
      keys.forEach( key => {
        console.log(key.id);
      });
    
      console.log('RESULTS:', {err, entities, info, keys});
    });
  3. aweiher
    closed this as completedon May 30, 2017
  4. stephenplusplus
    added
    api: datastoreIssues related to the Datastore API.
    type: questionRequest for information or clarification. Not an issue.
    on May 31, 2017
  5. JustinBeckwith
    assigned
    aweiher
    on Feb 1, 2021
  6. sofisl
    added 3 commits that reference this issue on Feb 25, 2026

    fix: Close Open Handle for Empty Objects (#2338)

    9974409

    fix: unhandled exceptions from gax (#2338)

    566628e

    chore(main): release 8.1.0 (#2305)

    f3bd153
  7. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    fix: Close Open Handle for Empty Objects (googleapis#2338)

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

Metadata

Metadata

Assignees

  • @aweiher
    aweiher

Labels

api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.

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.