Docs Menu
Docs Home
/ /
Atlas App Services
/ /

Sync Data Model Overview

On this page

  • Overview
  • Create a Data Model
  • Update a Data Model
  • Data Model Mapping

To use Atlas Device Sync you must define your data model in two formats:

  • App Services Schema: A server-side schema which defines your data in BSON. Device Sync uses the App Services Schema to convert your data to MongoDB documents and enforce validation and synchronize data between client devices and Atlas.

  • Realm Object Schema: Client-side schema of data defined using the Atlas Device SDKs with Realm Core database. Each Atlas Device SDK defines the Realm Object Schema in its own language-specific way. The Atlas Device SDKs use this schema to store data in the Realm database and synchronize data with Device Sync.

The App Services Schema and Realm Object Schema must be consistent with each other to sync data using Device Sync.

You can also sync data between clients using different Atlas Device SDKs, as long as they implement the same Realm Object Schema. These Realm Object Schemas must all be consistent with the App Services Schema as well.

For example, you have an iOS app and an Android app with their Realm Object Schemas defined using the Atlas Device SDK for Swift and the SDK for Kotlin, respectively. Both these mobile applications sync data using the same App Services App with Device Sync. The Swift SDK schema and the Kotlin SDK schema must both be consistent with the same App Services Schema.

You can create your Device Sync data model in a few ways.

If you already have data in Atlas, you can generate an App Services Schema by sampling that data. You can then generate a Realm Object Schema for each Atlas Device SDK.

If you prefer to develop your Realm Object Schema using the Atlas Device SDKs first, use Development Mode. When you use Development Mode, Device Sync automatically generates an App Services Schema when you sync data from a client using an Atlas Device SDK.

For more information on these approaches to modeling data, refer to Create a Data Model.

When developing an application using Atlas Device Sync, you may need to make changes to your data model. This means you also need to update your App Services Schema and Realm Object Schema.

For more information on how to perform the different types of data model changes, refer to Update a Data 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.


Configure and Update Your Data Model


Create a Data Model