save()
gstore has a global method "save" that is an alias of the original @google-cloud/datastore save() method, with the exception that you can pass it an Entity instance or an Array of entities instances and this method will first convert the instances to the correct Datastore format before saving.
This method accepts the following arguments:
Note: The entities can be of any kind. You can concat several arrays of queries from different Models and then save them all at once with this method.
options
The options object has 2 properties:
validate
(default false)method
(default "upsert"}
By default, validation is turned off as adds some overhead for large batch. If you need validation, just turn set validate
to true.
The method
option is the Datastore save() method. Valid values are: "insert", "update" or "upsert".
Example:
Last updated