Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Google Cloud Datastore support partial update like Mongodb $set?

I'm using Node.js, and don't want to overwrite the whole entity with every little updates and most of the time just need to update a specific properties like a counter for example.

There is not obvious reference on how to do this in the docs.

Does Node.js version Google Cloud Datastore support partial update like Mongodb $set?

like image 707
Teo Choong Ping Avatar asked Dec 14 '25 15:12

Teo Choong Ping


1 Answers

There is no DataStore API's to update an entity other than put() and putmulti(), so it is quiet impossible.

A bit of reading from here tells why.

Internally, App Engine stores entities in protocol buffers, efficient mechanisms for serializing structured data; see the open source project page for more details. Instead of storing each entity property as an individual column in the corresponding Bigtable row, a single column is used which contains a binary-encoded protocol buffer containing the names and values for every property of a given entity.

In short, an entity row in a Datastore is a single binary value in the underlying storage scheme which is why there is no API for partial update.

like image 173
Soundararajan Avatar answered Dec 16 '25 23:12

Soundararajan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!