node.js - 什么被视为针对 Google Cloud Datastore 中的实体组限制的写入

标签 node.js google-cloud-datastore google-cloud-platform distributed-database

根据数据存储文档,实体组的最大写入速率为每秒 1 个。

https://cloud.google.com/datastore/docs/concepts/limits

我想知道这种情况是否作为单个查询或多个查询计入该限制。

Stack Overflow 上也有类似的问题 - 但它们似乎并没有确认您可以做什么。

const datastore = require('@google-cloud/datastore')();

const key1 = datastore.key(['Users', 1, 'Comments']);

const comment1 = {
    userId: 1,
    commentBody: '...',
    ts: new Date(),
};

const key2 = datastore.key(['Users', 2, 'Comments']);

const comment2 = {
    userId: 2,
    commentBody: '...',
    ts: new Date(),
};

datastore.save({
    key: key1,
    data: comment1
}, (err) => {
    //
});

datastore.save({
    key: key2,
    data: comment2
}, (err) => {
    //
});

最佳答案

查看此处的实体,您有 2 个实体组:

  1. 用户/1
  2. 用户/2

然后您保存 2 个评论实体,每个实体组下一个。这算作每个实体组 1 次写入。

关于node.js - 什么被视为针对 Google Cloud Datastore 中的实体组限制的写入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43363902/

相关文章:

python - Google App Engine api 的命名空间管理器的范围是什么?

python - ndb 数据存储查询游标和索引问题

google-api - 如何设置公共(public) Google Cloud Storage 存储分区

javascript - 前端监听器监听后端监听器

javascript - JS 与 Python 字节数组编码

java - 什么是更好的方法?沮丧?界面?抽象类?

google-cloud-platform - 在Google Cloud执行个体上建立Kubernetes丛集时“403 Insufficient Permission”

google-cloud-platform - 在哪里可以找到 Google Cloud DNS 的 DNSSEC 值?

node.js - 使用 Jest 模拟 namespace 和具有相同名称的函数

node.js - 没有为使用 nyc 的 vscode 扩展生成覆盖信息