Docs Menu
Docs Home
/ /
Atlas Device SDKs
/

Sync Data Between Devices - Node.js SDK

On this page

  • Flexible Sync
  • Group Updates for Improved Performance

Atlas Device Sync automatically synchronizes data between client applications and an Atlas App Services backend. When a client device is online, Sync asynchronously synchronizes data in a background thread between the device and your backend App.

Device Sync has two sync modes: Flexible Sync and the older Partition-Based Sync. We recommend using the Flexible Sync mode for new apps. For more information on using Partition-Based Sync, refer to Partition-Based Sync - Node.js SDK.

When you use Sync in your client application, your implementation must match the Sync Mode you select in your backend App configuration. You can only use one Sync Mode for your application. You cannot mix Partition-Based Sync and Flexible Sync within the same App.

Tip

See also:

When you select Flexible Sync for your backend App configuration, your client implementation must include subscriptions to queries on queryable fields. Flexible Sync works by synchronizing data that matches query subscriptions you maintain in the client application.

A subscription set contains a set of queries. Realm Flexible Sync returns documents matching those queries, where the user has the appropriate permissions to read and/or read and write the documents. If documents match the query, but the client does not have the permission to read or write them, they do not sync to the client application.

You can form queries using Realm Query Language.

Note

Flexible Sync does not support all the query operators available in Realm Query Language and the SDK's query engine. See Flexible Sync RQL Limitations for details.

Subscription sets are based on a specific type of Realm object. You might have multiple subscriptions if you have many types of Realm objects.

To use Flexible Sync in your client application, open a synced realm with a flexible sync configuration. Then, manage subscriptions to determine which documents to sync.

Every write transaction for a subscription set has a performance cost. If you need to make multiple updates to a Realm object during a session, consider keeping edited objects in memory until all changes are complete. This improves sync performance by only writing the complete and updated object to your realm instead of every change.

Tip

Device Sync supports two Sync Modes: Flexible Sync, and the older Partition-Based Sync. If your App Services backend uses Partition-Based Sync, refer to Partition-Based Sync - Node.js SDK.

We recommend new apps use Flexible Sync.

Back

Create & Manage User API Keys