解析对象 ID 在 类 中是否唯一?
Are Parse Object ID's unique across classes or not?
我想知道是否为存储在 Parse.com 上的对象自动生成的 ObjectId,如果它们在多个 类 中是唯一的,或者没有这样的保证
整个网络上都有相互矛盾的证据(见下文)。有人可以指点我可以找到它的官方文档吗,因为我自己似乎找不到它。
解析可能正在使用 Mongodb 中生成的 ID。它们不是随机生成的,但由于每个 class 都可能具有唯一的签名,因此生成的 ID 将保证在所有 classes:
中都是唯一的
A BSON ObjectID is a 12-byte value
consisting of a 4-byte timestamp
(seconds since epoch), a 3-byte
machine id, a 2-byte process id, and a
3-byte counter
不,您不能保证它是唯一的。这就是解释:
您可以上传 object,使用 DataBrowser 中的上传功能(JSON 或 CSV 文件),使用您想要的任何 ID,甚至 "IDENTITY_1"。在上传期间,它将根据正在上传的 Collection 进行验证。不反对所有 collections.
话虽如此,您有可能在 Collection 秒内重复 ID。
因此,请勿基于此假设进行编码。
一位 Parse 员工回答了您的问题:
We only guarantee they will be unique on a per class basis. We'll update the iOS docs to reflect this, thanks for pointing it out.
Note that you'll need billions of objects before you have even a slight chance of having a duplicate. So you can probably assume that it will not happen. We simply don't enforce it when we generate it.
我想知道是否为存储在 Parse.com 上的对象自动生成的 ObjectId,如果它们在多个 类 中是唯一的,或者没有这样的保证
整个网络上都有相互矛盾的证据(见下文)。有人可以指点我可以找到它的官方文档吗,因为我自己似乎找不到它。
解析可能正在使用 Mongodb 中生成的 ID。它们不是随机生成的,但由于每个 class 都可能具有唯一的签名,因此生成的 ID 将保证在所有 classes:
中都是唯一的A BSON ObjectID is a 12-byte value consisting of a 4-byte timestamp (seconds since epoch), a 3-byte machine id, a 2-byte process id, and a 3-byte counter
不,您不能保证它是唯一的。这就是解释:
您可以上传 object,使用 DataBrowser 中的上传功能(JSON 或 CSV 文件),使用您想要的任何 ID,甚至 "IDENTITY_1"。在上传期间,它将根据正在上传的 Collection 进行验证。不反对所有 collections.
话虽如此,您有可能在 Collection 秒内重复 ID。
因此,请勿基于此假设进行编码。
一位 Parse 员工回答了您的问题:
We only guarantee they will be unique on a per class basis. We'll update the iOS docs to reflect this, thanks for pointing it out.
Note that you'll need billions of objects before you have even a slight chance of having a duplicate. So you can probably assume that it will not happen. We simply don't enforce it when we generate it.