Reputation: 12808
I am using Google Cloud node.js gcloud library and trying to get an entity that was saved with ancestor key.
To my surprised, I am not able to get the entity without specifying its ancestor key.
const ds = gcloud.datastore.dataset(config);
...
ds.get(key, (err, entity)=>{
return entity;
});
Upvotes: 3
Views: 198
Reputation: 42018
The unique identifier for your entity is the full path, the id/name of the entity is not globally unique.
As an example, let's assume you were modelling a basic file system that has folders and files. Folders are the parent entities and files are the child entities. You might for example have data like:
Without specifying the ancestor, the system cannot disambiguate which 'readme.txt' you are trying to reference.
Upvotes: 1