Docs Menu
Docs Home
/ /
Atlas Device SDKs
/

Partition-Based Sync

On this page

  • Migrate from Partition-Based Sync to Flexible Sync
  • Update Client Code After Migration
  • Open a Synced Database with Partition-Based Sync

Partition-Based Sync is a legacy mode for using Atlas Device Sync with Atlas Device SDK. You can no longer create new Partition-Based Sync apps. All of the Device Sync-related content on other pages in the SDK docs assume your app uses the default Sync mode, Flexible Sync.

This page covers how to migrate a Partition-Based Sync app to a Flexible Sync app. For apps that still use Partition-Based Sync, this page also has details for opening a database with Partition-Based Sync.

Tip

C++ and Flutter SDKs Do Not Support Partition-Based Sync

The examples on this page do not include details for C++ or Dart because the C++ and Flutter SDKs have never supported Partition-Based Sync.

You can migrate your app from Partition-Based Sync mode to Flexible Sync. Migrating is an automatic process that does not require any changes to your application code. Automatic migration requires the following minimum SDK versions:

  • .NET SDK v11.1.0 and later

  • Java SDK v10.16.0 and later

  • Kotlin SDK v1.9.0 and later

  • Node.js SDK v11.10.0 and later

  • Swift SDK v10.40.0 and later

Migrating enables you to keep your existing App Services users and authentication configuration. Flexible Sync provides more versatile permissions configuration options and more granular data synchronization.

For more information about how to migrate your App Services App from Partition-Based Sync to Flexible Sync mode, refer to Migrate Device Sync Modes in the App Services documentation.

The automatic migration from Partition-Based Sync to Flexible Sync does not require any changes to your client code. However, to support this functionality, the SDK automatically handles the differences between the two Sync Modes by:

  • Automatically creating Sync subscriptions for each object type where partitionKey == partitionValue.

  • Injecting a partitionKey field into every object if one does not already exist. This is required for the automatic Sync subscription.

If you need to make updates to your client code after migration, consider updating your client codebase to remove this hidden migration functionality.

You might want update your client codebase when:

  • You add a new model or change a model in your client codebase.

  • You add or change functionality that involves reading or writing SDK objects.

  • You want to implement more fine-grained control over what data you sync.

Make these changes to convert your Partition-Based Sync client code to use Flexible Sync:

For examples of Flexible Sync permissions strategies, including examples of how to model data for these strategies, refer to the Device Sync Permissions Guide in the App Services documentation.

You can open a synced database for Partition-Based Sync by passing the appropriate partition value in the Sync configuration.

Tip

Partition Value

For App Services Apps that use Partition-Based Sync, your client implementation must include a partition value. This is the value of the partition key field in the Partition-Based Sync configuration.

The partition value determines which data the client application can access.

You pass in the partition value when you open a synced database.

← 
 →