Reputation: 777
I "stole" this example from Google documentation:
function listTasks() {
const query = datastore.createQuery('Task').order('created');
datastore
.runQuery(query)
.then(results => {
const tasks = results[0];
console.log('Tasks:');
tasks.forEach(task => {
const taskKey = task[datastore.KEY];
console.log(taskKey.id, task);
});
})
.catch(err => {
console.error('ERROR:', err);
});
}
It didn't work at first but after I found an answer on SO about login thingy now I see some results. The problem is... I am trying to display all the entities from 1 collection. Collection called "Tasks" since it was also taken from the docs. It has only 1 entry right now:
I see only Tasks:
displayed in the console without any information from the actual DB. Is there anything wrong with the official code?
Upvotes: 1
Views: 2466
Reputation: 777
Ok, I am slow. So the problem was that .order('created')
isn't a "built-in" functionality, I don't have that property in my collection so nothing to sort by. Weird that it wasn't causing an error because of that, but without it everything worked.
Upvotes: 4