Creation
Each entity is an instance of a Model and represents an entity stored in the Datastore of a certain Kind. To create an entity you call the Model constructor
id
(optional)
By default, if you don't pass an id when you create an instance, the entity id will be auto-generated. If you want to manually give the entity an id, pass it as a second parameter during the instantiation.
If the ID integer is outside the bounds of a JavaScript Number object, you have to create an Int calling the int() method from @google-cloud/datastore
Reminder: gstore.ds is an alias to the google-cloud datastore instance.
ancestors
(optional)
You can define the ancestors of the entity.
namespace
(optional)
By default entities keys are generated with the default namespace (defined when setting up the '@google-cloud/datastore'). You can create models instances on another namespace by passing it as a third parameter.
Last updated
Was this helpful?