Trying to get entities from my google cloud datastore, filtered by a key name. Not sure what am I doing wrong here in my code.
I create my datastore
const ds = new Datastore({
projectId: "my-project",
keyFilename: "./servicekey.json",
namespace: "client-dummy",
});
Then create a key for filtering
const _key = ds.key({
namespace: "client-dummy",
path: ["transactions", data.id],
});
create my query by supplying the namespace, kind and key based filter.
const query = ds
.createQuery("client-dummy", "transactions")
.filter("__key__", _key);
And finally run the query
const result = await ds.runQuery(query);
But results are always empty
[ [], { moreResults: 'NO_MORE_RESULTS', endCursor: 'CgA=' } ]
I have tried running same queries on the UI and get results. I don't know what's wrong in the code. Can someone help?
data.id
? – vitooh