Docs Menu

Docs HomeAtlas App Services

Sync Settings

On this page

  • Available Settings
  • Sync Type
  • Development Mode
  • Cluster to Sync
  • Database Name (Development Mode Only)
  • Queryable Fields
  • Permissions
  • Asymmetric Sync
  • Client Max Offline Time
  • Client Recovery
  • Sync Configuration File Reference
  • Sync Config Object

This page explains the settings available when you enable or configure Device Sync.

Atlas Device Sync has two sync modes: Flexible Sync and the older Partition-Based Sync. We recommend using Flexible Sync. For information about Partition-Based Sync, refer to Partition-Based Sync.

Flexible Sync lets you define a query in the client and sync only the objects that match the query. With client-side subscriptions, client applications can:

  • Maintain queries

  • React to changes

  • Add, change, or delete queries

Development Mode is a configuration setting that allows Device Sync to infer and update schemas based on client-side data models. This streamlines development, but should not be used in production.

Development Mode speeds up development by allowing you to design schemas directly in client application code.

When you sync a realm file, Atlas App Services maps every synced object type to its own collection in the database specified by Database Name (Development Mode Only). If you update the object model on the client side, App Services updates the collection schema to match. This lets you update objects in your client code as you develop your app.

You can use data access rules with Development Mode. Note that schema changes ignore data access rules. This means that any client can update the backend schema by changing the client model.

To learn more about how the Realm Object Schemas map to the App Services Schemas when using Development Mode, refer to Data Model Mapping.

For more information about modifying synced object schemas, including how to handle breaking changes, see: Update Your Data Model.


Disable Development Mode for Production Apps

Development mode is a development utility that is not suitable for production use. Make sure that you turn off Development Mode before you make your app accessible in a production environment.

The name of the Atlas cluster data source where you want the synced data stored.

Flexible Sync requires MongoDB 5.0. You cannot use Sync with a serverless instance. In the UI, clusters display as gray and not-selectable when they do not meet the requirements for Flexible Sync.

When you enable Development Mode, you specify a database to store synced objects. App Services creates new collections in this Development Mode database for every type of synced object.


Specify a Development Mode database of myapp. Your iOS client has a Person model. You sync a realm that contains an instance of the Person object. Development Mode creates a server-side schema associated with the model. The object syncs to the myapp.Person collection.

App Services continues creating new server-side schemas and collections for each new object type. If you later add a Dog object, that object will sync to a new myapp.Dog collection that App Services will create.

When you configure Flexible Sync, you specify field names that your client application can query. Fields that can be used in a subscription query are called queryable fields.

You can automatically specify queryable fields by enabling Development Mode. Development Mode allows App Services to automatically mark fields as queryable as they are used.

Queryable fields apply across all collections in an App's Schema. You can use rules and permissions to configure more granular access control on individual collections.

The field names you provide are arbitrary strings. If an object type has a field whose name matches a field name you provided (and meets other eligibility criteria), that field becomes available to Device Sync to query.


In a to-do list app, you might set assignee or owner as queryable fields. On the client side, you can then query for tasks whose assignee or owner matches the logged-in user.

Flexible Sync only supports top-level primitive fields with a scalar type as queryable fields. You can also include arrays of these primitives as queryable fields. Flexible Sync does not support embedded objects or arrays of objects as queryable fields.


See also: Realm Query Language - Flexible Sync Limitations

For information on the queries you can perform on these fields, see: Flexible Sync RQL Limitations

App Services reserves some keywords for the Realm Query Language and other purposes. You cannot use reserved keywords as field names.

App Services reserves the following keywords with any capitalization:

  • and

  • asc

  • ascending

  • beginswith

  • between

  • contains

  • desc

  • descending

  • distinct

  • endswith

  • falsepredicate

  • inf

  • infinity

  • like

  • limit

  • nan

  • nil

  • null

  • or

  • sort

  • subquery

  • truepredicate


You cannot use descending, Descending, DESCENDING, or DeScEnDiNG as a field name.

App Services also reserves the following keywords with the given exact capitalization:

  • ALL

  • ANY

  • B64


  • IN

  • NONE

  • NOT

  • SOME

  • TRUE

  • all

  • any

  • false

  • in

  • none

  • not

  • oid

  • some

  • true

  • uuid


You cannot use true or TRUE, since both capitalizations are specifically reserved, but you can use True or tRUE as a field name.

Each queryable field adds additional metadata storage to your Atlas cluster and may lead to degraded write performance. You should have as few queryable fields as needed by your application. A good rule of thumb is to have at most 10 queryable fields.

You can update your Sync configuration to add or remove queryable field names, but be aware of the following:

When you add a queryable field, devices can only sync on that field once the device has caught up to the point in time in Device Sync History where the field was added.

When you remove a queryable field, any devices still using that field will have their Device Sync session dropped and must perform a client reset. Clients not using the removed field won't receive any errors. To avoid triggering a client reset when you remove the queryable field, you should first remove usage of that field on the client-side.

Atlas Device Sync enforces role-based data access rules for all requests to a synced cluster. Rules are dynamic JSON expressions that determine a user's ability to sync, view, and modify data.

For details, see Role-based Permissions.

Asymmetric Sync is a sync strategy for applications with heavy client-side insert-only workloads. You can enable it for one or more collections. It supports writing to any collection type, including an Atlas time-series collection.

For example, an IoT app that frequently logs sensor data has a significant write workload and no read workload. The device may also be offline for extended periods of time. Asymmetric Sync bypasses some of the processing required for bi-directional sync, significantly improving write speed to an Atlas collection.

Other use cases include writing immutable data, such as invoices from a retail app, or logging application events, neither of which requires conflict resolution.

You can apply Asymmetric Sync to individual collections. This means your app can use Asymmetric Sync to write some data, but bi-directional Flexible Sync on other collections.

Asymmetric Sync collections are only for writing data. You cannot use Flexible Sync queries against these collections. Instead, use Connect to MongoDB Data Sources.

After you have enabled Asymmetric Sync, you implement it in the client app via the client SDKs. Currently, the following Realm SDKs support Asymmetric Sync:

Client Maximum Offline Time determines how long the client can be offline between sync sessions. Changing this value enables you to balance offline access with storage used in the synced Atlas cluster. For more information, refer to Client Maximum Offline Time.

Client Recovery enables the client to attempt to automatically perform a client reset while recovering data on the device. For more information, refer to Recover Unsynced Changes.

You can find the Sync configuration file for your application in the sync directory of an exported app:

└── sync/
└── config.json

For example, the following Sync configuration applies to apps using Flexible Sync (recommended). If you are using the older Partition-Based Sync, refer to Partition-Based Sync Configuration.

"type": "flexible",
"development_mode_enabled": <Boolean>,
"service_name": "<Data Source Name>",
"database_name": "<Development Mode Database Name>",
"state": <"enabled" | "disabled">,
"client_max_offline_days": <Number>,
"is_recovery_mode_disabled": <Boolean>,
"queryable_fields_names": [
<Array of String Field Names>
"permissions": "<Deprecated, Do Not Use>"

The deprecated permissions field might still appear in your exported app's configuration. That might indicate your app has not automatically migrated to the unified rule system yet. Please avoid deleting this field until your app has been migrated.


The sync mode. There are two Sync modes: Flexible Sync and the older Partition-Based Sync. We recommend using Flexible Sync. For more information about Partition-Based Sync, refer to Partition-Based Sync.

Valid Options for a Flexible Sync Configuration:

  • "flexible"

If true, Development Mode is enabled for the application. While enabled, App Services automatically stores synced objects in a specific database (specified in database_name) and mirrors objects types in that database's collection schemas.
The name of the Atlas cluster data source to sync. You cannot use sync with a serverless instance.
The name of a database in the synced cluster where App Services stores data in Development Mode. App Services automatically generates a schema for each synced type and maps each object type to a collection within the database.

The current state of the sync protocol for the application.

Valid Options:

  • "enabled"

  • "disabled"

Controls how long the backend compaction process waits before aggressively pruning metadata that some clients require to synchronize from an old version of a realm.
If false, Recovery Mode is enabled for the application. While enabled, Realm SDKs that support this feature attempt to recover unsynced changes upon performing a client reset. Recovery mode is enabled by default.
The names of the fields that your client application can query to determine which data to synchronize.
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).
←  Configure and Enable Atlas Device SyncPause or Terminate Sync →
Share Feedback
© 2023 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.