I created a simple datastore (projects) with one string property (name) and some example datasets.
When I use gql I can select the __key__ and can query by the __key__ property.
But when I select the data from nodejs, the __key__ property is empty.
examples:
not working: selecting all datasets with key-only query:
const query = datastore.createQuery('Projects').select('__key__');
datastore.runQuery(query).then( results => {
console.log('RESULTS:', results[0]);
})
result:
RESULTS: [ {}, {}, {} ]
A normal query works as expected:
datastore.runQuery(query).then( results => {
console.log('RESULTS:', results[0]);
})
.. but here also the __key__ property is missing:
RESULTS: [ { name: 'Test Projekt 1' },
{ name: 'Test Projekt 2' },
{ name: 'Test Projekt 3' } ]
How do I select the __key__ property with the @google-cloud/datastore module correctly?
via alwe
No comments:
Post a Comment