I'm using following query to retrieve some entities from google Datastore:
var query = datastore.createQuery(namespace,tableName);
query.select(['displayName','username']);
datastore.getEntitySet(query,function(err,data){
if(err){
res.status(500).end();
}
else{
res.send(data);
}
});
The above code works fine if I select only one property i.e.
query.select('username');
But with multiple select its throwing 412 'Precondition Failed' error. my entity looks like the following: Entity properties
You need to create a multi-property index in order to use multi-property queries.
Because you are not using App Engine, these indexes need to be manually created.
I have a tutorial here that covers this.
Here are the steps:
path/to/gcd.sh updateindexes --auth_mode=oauth2 .
path/to/gcd.cmd updateindexes --auth_mode=oauth2 .
After a few minutes, your indexes should be created.