googleDatastore
Utility class to interact with Google Datastore
getEntity
Get a Google Datastore entity
Syntax
googleDatastore.getEntity({entityName, entityKey})entityNamedatastore entity group nameentityKeyentity keyreturns a Promise.
Example
const entityName = "MASTER";
const entityKey = "PIPPO"
}
const ret = googleDatastore.getEntity({entityName, entityKey)
.then((res) => {
//..
})
.catch((err) => {
//..
});insertEntity
Insert a Google Datastore Entity
Syntax
entityNamedatastore entity group nameentityentity objectentityAttributesmap attribute - typereturn a Promise
Example
updateEntity
Update a Google Datastore Entity.
Syntax
entityNamedatastore entity group nameentityKeyentity keyentityObjobject to saveentityAttributesmap attribute - typeforceNullFieldsforce not pass field to nullreturn a Promise
Example
deleteEntity
Delete a Google Datastore entity
Syntax
entityNamedatastore entity group nameentityKeyentity to delete keyreturn a Promise
Example
list
Return a list of entities
Syntax
[select]fields to extractentityNamedatastore entity group name[filters]array of filter objects:propertyproperty to filtervaluefilter value[operator]filter operator, default=
[order]order objectpropertyproperty to order[descending]true: descending,false: ascending, defaultfalse
limit[offset]return a Promise
In case the query searches only some fields or in case some sortings are necessary, it will be necessary to create indexes: if you are curious to understand how they work, check here: Indexes. If, you have already started using them and want to understand how to optimize them: Index optimization
Example
Last updated