Navigation

Realm Sync Configuration Files

On this page

  • Configuration

You can configure Realm sync for your application in the sync directory:

app/
└── sync/
└── config.json
sync/config.json
{
"state": <"enabled" | "disabled">,
"development_mode_enabled": <Boolean>,
"service_name": "<Data Source Name>",
"database_name": "<Development Mode Database Name>",
"partition": {
"key": "<Partition Key Field Name>",
"type": "<Partition Key Type>",
"permissions": {
"read": { <JSON Expression> },
"write": { <JSON Expression> }
}
},
"last_disabled": <Number>
}
Field
Description
state
String

The current state of the Sync protocol for the application.

Valid Options:

  • "enabled"
  • "disabled"
service_name
String
The name of the Atlas cluster data source to sync.
development_mode_enabled
Boolean

If true, development mode is enabled for the application. While enabled, Realm automatically stores synced objects in a specific database (specified in database_name) and mirrors objects types in that database's collection schemas.

Important

Realm does not enforce rules when development mode is enabled.

database_name
String
The name of a database in the synced cluster where Realm stores data in development mode. Realm automatically generates a schema for each synced type and maps each object type to a collection within the database.
partition.key
String
The field name of your app's partition key. This field must be defined in the schema for object types that you want to sync.
partition.type
String

The value type of the partition key field. This must match the type defined in the object schema.

Valid Options:

  • "string"
  • "objectId"
  • "long"
partition.permissions.read
JSON Expression
An expression that evaluates to true when a user has permission to read objects in a partition. If the expression evaluates to false, Realm does not allow the user to read an object or its properties.
partition.permissions.write
JSON Expression
An expression that evaluates to true when a user has permission to write objects in a partition. If the expression evaluates to false, Realm does not allow the user to modify an object or its properties.
last_disabled
Number
The date and time that sync was last paused or disabled, represented by the number of seconds since the Unix epoch (January 1, 1970, 00:00:00 UTC).
Give Feedback

On this page

  • Configuration