I'm trying to access data that I have stored in datastore (in datastore mode). For some reason, I can't access any data it seems.
Things I've tried.
const datastore = new Datastore({projectId: '...'});
const key = datastore.key([<kind>, <id>]);
return datastore.get(key, (err, entity, x) => {
console.log("yolo", err, entity, x);
return entity;
});
const query =
datastore.createQuery(<kind>);
return datastore.runQuery(query, (err, e, nq) => {
console.log(err, e, nq);
return e;
});
Both of the above yields no result. I am 100% sure I have typed the kind
correctly.
So this was a stupid mistake on my end, but I keep the question in case someone else does the same mistake.
What I did when I created the entry in datastore was that I put it in a namespace, but then I didn't provide the namespace when I queried for it. Just providing the namespace and I was all good.