Are Realm partition IDs recycled if a user is deleted?

Hello there! I have a question which is supposedly targeted to the devs as I haven’t found any mention of it in the docs, and it’s pretty implementation specific.

Every App Services user is assigned an ID which acts as a partition in Realm. So the question is are these IDs reused when a user is deleted from App Services or every user gets a unique ID every time?

For example, User1 had partition1 and at some point the user has been deleted. Is it possible for UserN to be assigned partition1 once again?

Hi @Gleb_Ignatev,

are these IDs reused when a user is deleted from App Services

No, they can’t be: user ID is an ObjectId, that are meant to be unique. In fact, part of the structure of an ObjectId is the timestamp when the object is created, so each and every user will always be unique.

Is it possible for UserN to be assigned partition1 once again?

That depends on the logic you apply between the user and the partition: if the partition value is just the ID of the user itself, it won’t be possible to bind the two, and when the user is gone, the partition will be inaccessible, but if partition1 refers to some other value to be bound to a specific user, then yes, it can be re-assigned.

1 Like

I see, it’s been really on the surface. Thank you for the quick response!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.