gpt4 book ai didi

google-app-engine - 使用相同的键覆盖写入 google-app-engine 数据存储相同的实体 - 预期吗?

转载 作者:行者123 更新时间:2023-12-03 04:41:01 24 4
gpt4 key购买 nike

我有一个数据存储对象,它使用类中的字段之一来创建 key 。假设我有一个对象“a”,该字段的值为“k”。如果我尝试将对象“b”添加到数据存储区,该数据存储区的字段值也为“k”,则对象“b”将覆盖对象“a”。只是想确认这是否是预期的行为。虽然它看起来很明显,但如果有人能解释基本概念那就太好了..

最佳答案

正如 Adam 所解释的,简短的答案是两个实体不能共享相同的 key (想象一个字典)。不过,长答案有点复杂。请参阅docs :

Paths and Key Uniqueness

The complete key of an entity, including the path, the kind and the name or numeric ID, is unique and specific to that entity. The complete key is assigned when the entity is created in the datastore, and none of its parts can change.

The keys of two different entities can have similar parts as long as at least one part is different. For instance, two entities can have the same kind and name if they have different parents. Similarly, two entities can have the same parent (or no parent) and name if they are of different kinds.

An application should not rely on numeric IDs being assigned in increasing order with the order of entity creation. This is generally the case, but not guaranteed.

关于google-app-engine - 使用相同的键覆盖写入 google-app-engine 数据存储相同的实体 - 预期吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2049817/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com