ObjectID, String or Int as primary key. Does it matter?

Currently in the process of migrating a local app (custom sync) to MongoDb Realm. As a part of this I am doing database migrations to make the current schema better suited for sync, which makes it possible to migrate gradually.

In the old schemas, all primary keys are strings. In MongoDb Realm it is allowed to use Strings, Int or ObjectId. Is there any difference between them? Do I loose anything if I keep using strings instead of ObjectIId?

1 Like

Hi @Simon_Persson – I think that the only thing you’d lose is the ability to generate unique keys (but then you can also create unique UUIDs and convert them to a string).