Reputation: 1988
I'd like to know if ObjectIds that are auto-generated for objects stored on Parse.com, if they are unique across multiple classes or there can be no such guarantee
There is contradicting evidence for this all over the web (see below). Can someone point me to the official docs where this can be found, since I cant seem to find it myself.
Upvotes: 1
Views: 524
Reputation: 91
A Parse employee answered your question:
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.
Upvotes: 4
Reputation: 386
No, you CAN'T guarantee it is unique. That's the explanation:
You can upload an object, using the upload feature in DataBrowser (JSON or CSV files), using any ID you want, even something like "IDENTITY_1". During the upload, it will validate against the Collection being uploaded. Not against all collections.
With that said, there is a chance you have repeated IDs across Collections.
So, do not code based on this assumption.
Upvotes: 2
Reputation: 2717
Parse is probably using ids generated in Mongodb. They are not randomly generated but as each class will potentially have a unique signature, the ids generated will guaranteed to be unique across all 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
http://www.mongodb.org/display/DOCS/Object+IDs
Upvotes: 1