GET
Get one entity from the Datastore. Retrieving an entity by key is the fastest way to read from the Datastore. This method accepts the following arguments:
@Returns -- a gstore entity instance.
Example:
The resulting entity has a plain() method that returns an object with the entity data + its id. See the documentation of plain() here.
If you need to retrieve an entity from inside a transaction, you can pass the transaction object as fourth parameter.
options properties
ancestors
transaction
namespace
preserveOrder
(default:false
)dataloader
: a Dataloader instancecache
(default:true
)ttl
(default: the global cachettl.keys
configuration)
> ancestors: Ancestors path for the entity (eg: ['ParentEntity', 'parentName' ]
)
> transaction: Optional transaction to execute the get request.
> namespace: Optional namespace for the entity.
> dataloader Optional Dataloader to use to fetch the entity. Read the documentation for more information on how to create a dataloader
the instance.
> cache If you activated the cache on the gstore-node instance, you can override here the global cache configuration. If the cache for keys fetching has been activated (default: true
), you can pass false
here to bypass the cache. If the cache for keys fetching has been disabled, then you can pass true
here to cache specific key(s).
> ttl Overrides the global keys TTL of the cache. If you have multiple cache stores, you can pass an Object with a different value for each store. See in the example below.
Last updated