node.js - Google Cloud Datastore 是否支持像 Mongodb $set 这样的部分更新?

标签 node.js google-app-engine google-cloud-datastore

我正在使用 Node.js,不想每次更新都覆盖整个实体,大多数时候只需要更新特定的属性,例如计数器。

文档中没有关于如何执行此操作的明显引用。

Node.js 版本的 Google Cloud Datastore 是否支持像 Mongodb $set 这样的部分更新?

最佳答案

除了 put() 和 putmulti() 之外,没有用于更新实体的 DataStore API,因此这几乎是不可能的。

一点阅读 from here说出原因。

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.

简而言之,Datastore 中的实体行是底层存储方案中的单个二进制值,这就是没有用于部分更新的 API 的原因。

关于node.js - Google Cloud Datastore 是否支持像 Mongodb $set 这样的部分更新?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35884724/

相关文章:

python - 在谷歌云数据存储上每次插入/删除后是否有回调?

javascript - Require 在 NodeJS 应用程序中无法识别

python - 在 Google App Engine 中上传文件。如何获取文件到上传Handler类

node.js - 来自其他集合的 Mongoose 文档群体

google-app-engine - 在 Google App Engine 上,我如何在 GQL 中查找客户的最新订单?

python - Vim & GAE - 是否有使用 vim 调试 python gae 应用程序的方法?

google-app-engine - GAE Golang - 查询在保存后不立即返回数据

go - 为用户可以编辑的页面(例如维基百科/stackoverflow 页面)设计数据存储架构

javascript - NodeJs 中的静态 HTTP 文件服务器 : Sometimes external . js 和 .css 文件加载正常,有时加载不正确?

node.js - 在 typescript 上扩展 super 测试