【问题标题】:Datastore emulator returns 'Only ancestor queries are allowed inside transactions’. Doesn't it support Firestore in Datastore mode?数据存储模拟器返回“事务内只允许祖先查询”。它不支持 Datastore 模式下的 Firestore 吗?
【发布时间】:2021-09-06 22:46:45
【问题描述】:

我在本地运行使用 Datastore 的应用程序。 该应用程序是用 Java 编写的并使用 Objectify。代码如下。

ofy().transact(() -> { ofy().load().type(PersonEntity.class).list(); })

当我的应用连接到我的 GCP 项目的数据存储区时,这个简单的查询会成功运行。

但是,当我使用cloud-datastore-emulator 时,此查询被拒绝并显示错误消息Only ancestor queries are allowed inside transactions

关于非祖先查询seems to be removed on Firestore in Datastore mode的此限制。但是 cloud-datastore-emulator 似乎仍然限制它。

我的问题是,

  • cloud-datastore-emulator 不支持 Datastore 模式下的 Firestore?
  • 有什么方法可以在 Datastore 模式下模拟 Firestore?

gcloud SDK 版本:346.0.0

【问题讨论】:

    标签: google-cloud-platform google-cloud-firestore google-cloud-datastore


    【解决方案1】:

    嗯,你的问题的答案是:它应该支持它,因为模拟器应该支持生产环境所做的一切。话虽如此,我在看到您的问题后确实浏览了文档,发现here 声明:

    Cloud SDK 包含一个local emulator of the production Datastore mode environment

    但是,如果您按照链接进行操作,就会发现这是旧版 Datastore 和处于 Datastore 模式的 Firestore 的模拟器。所以这可能就是你看到这种行为的原因。有了这些信息,最好在 Google's Issue Tracker 中打开一个案例,以便他们的工程团队可以澄清这是否是预期行为,如果不是,请解决此问题。

    【讨论】:

    猜你喜欢
    • 2012-07-20
    • 2012-07-06
    • 2020-01-14
    • 2020-01-14
    • 1970-01-01
    • 1970-01-01
    • 2017-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多