Get Started with Sync¶
You can enable Sync on any Realm app you have created.
In order to use Realm Sync, your Atlas cluster must use MongoDB version 4.4. When setting up your cluster, select MongoDB 4.4 from the dropdown menu under Additional Settings.
Navigate to the Realm Sync Panel¶
You can enable Realm Sync rules from the Sync panel in the Realm UI. To get to the Sync panel, click Sync beneath Build in the left-hand navigation.
Decide Whether to Use Development Mode¶
The Sync panel presents you with two tabs: Configuration and Development Mode. The tab that you should select depends on whether you want to define your object models in client-side code or prefer to use a server-side configuration.
Select the Configuration tab if you want Realm to generate the client-side object model code for you based on your schemas. MongoDB Realm can generate schemas for you based on data already in your cluster, or you can define them yourself.
Select the Development Mode tab if you would rather define and modify your object model in client-side code.
Follow the instructions in the Realm UI to configure sync for your cluster.
- Select a Cluster to Sync: Realm Sync applies to the entire cluster. Specify which cluster you want to sync in the dropdown.
- Define a Database Name (Development Mode Tab Only): If you opted to use Development Mode, Realm needs to know which database in your cluster to use for new collections it creates for Sync. Specify that database name in the input field.
- Choose a Partition Key: Specify which field to use to determine which realm each object belongs to. See Partition Atlas Data into Realms.
- Define Permissions (Configuration Tab Only): Select a template from the dropdown or enter your read and write sync rule in the input boxes.
Save the Configuration and Enable Sync¶
On the Configuration tab, click Enable Sync to enable sync.
On the Development Mode tab, click Turn Dev Mode On to enable sync with Development Mode.
- You can enable Realm Sync on your linked cluster for any Realm app you have created.