Great guide! That will be super helpful to a lot of developers.
Q: Is what’s laid out in the guide only applicable to working with Realm in the cloud? Or is it a general design pattern for even local (non-cloud) Realms? e.g. should local only apps include a _partitionKey? and should we be using
ObjectId.generate() instead of
In the Guide
Also, your new
_id must be either an ObjectId, a String, or an Int.
Docs - probably just need to add “Int” assuming that’s allowable
A primary key is a String or
ObjectId property that uniquely identifies an object.
and a question about primary keys:
In the Guide
The first thing you will need to do is convert your primary keys on your Realm Objects from your previous Primary Key field name to the required primary key of all MongoDB documents; which is
If an object type has a primary key, then all instances of that type must include the primary key
So two questions:
In one case it sounds required, the other case sounds optional if an object instead of required. Is it required?
It sounds like the primary key var must be named
_id is that correct?
If every object is required to have _id, the docs should be updated to match
Override this method to specify the name of a property to be used as the primary key.
Only properties of types
Int can be designated as the primary key.