4
4
Get Started with Atlas Device Sync
5
5
==================================
6
6
7
- .. meta::
8
- :description: Learn how to get started with Atlas Device Sync in this high-level overview.
7
+ .. meta::
8
+ :description: Get started using Atlas Device Sync with this high-level overview.
9
+ :keywords: Realm, C++ SDK, Flutter SDK, Java SDK, Kotlin SDK, .NET SDK, Node.js SDK, React Native SDK, Swift SDK, mobile app development, MongoDB mobile
9
10
10
11
.. facet::
11
- :name: genre
12
+ :name: genre
12
13
:values: reference
13
14
14
15
.. contents:: On this page
@@ -17,14 +18,13 @@ Get Started with Atlas Device Sync
17
18
:depth: 2
18
19
:class: singlecol
19
20
20
- To sync data across devices, you :ref:`enable Device Sync <enable-sync>` for your
21
- App and then use the sync-related methods and properties in the SDKs .
21
+ To sync data across devices, :ref:`enable Device Sync <enable-sync>`, then use the sync-related methods and properties in the
22
+ :ref:`Atlas Device SDK <realm-sdks>` .
22
23
23
24
.. tip:: Check out the tutorial
24
-
25
- If you prefer to learn by example, check out the App Services
26
- `tutorial <https://www.mongodb.com/docs/realm/tutorial/>`_, which describes
27
- how to build a synced to-do list application with clients for common
25
+
26
+ If you prefer to learn by example, check out the Device Sync
27
+ :ref:`tutorial <app-services-get-started-tutorials>`, which uses a synced to-do list application with clients for common
28
28
platforms that App Services supports.
29
29
30
30
Before You Start
@@ -33,13 +33,14 @@ Before You Start
33
33
- If you don't already have one, `sign up for a free MongoDB Atlas account
34
34
<https://www.mongodb.com/cloud/atlas/register?tck=docs_realm>`__.
35
35
36
- - Flexible Sync requires MongoDB version 5.0 or later. You can use a free shared
36
+ - Device Sync requires an Atlas cluster running MongoDB version {+sync-min-mongo-version-required+} or
37
+ later. You can use a free shared
37
38
M0 cluster to explore and develop your app. We recommend that you use a
38
39
dedicated tier cluster (M10 and above) for production applications. You cannot
39
40
use sync with a :ref:`serverless instance <serverless-caveats>` or
40
41
:ref:`{+adf-instance+} <data-federation-caveats>`.
41
-
42
- - If you don't already have one, :ref:`create a new App
42
+
43
+ - If you don't already have one, :ref:`create a new App Services App
43
44
<create-app>` linked to your Atlas cluster.
44
45
45
46
Configure Your Data Model
@@ -48,14 +49,16 @@ Configure Your Data Model
48
49
Choose an SDK
49
50
~~~~~~~~~~~~~
50
51
51
- Realm is an object database optimized for mobile use cases. The
52
- :ref:`Realm SDKs <realm-sdks>`, available for multiple languages and
53
- platforms, include everything you need to work with synced "realms" in your
54
- client code. You can use multiple SDKs to work with the same set of synced data
52
+ :ref:`Atlas Device SDK <realm-sdks>` wraps Realm Core Database, an object
53
+ database optimized for mobile and edge use cases. The SDK, available for multiple languages
54
+ and
55
+ platforms, includes everything you need to work with synced databases in your
56
+ client code. You can use multiple SDK languages to work with the same set of synced data
55
57
across devices and platforms.
56
58
57
- This guide focuses on configuring sync with an SDK. For in-depth documentation
58
- that includes details on how to install and use the Realm SDKs more generally,
59
+ This guide focuses on configuring Device Sync with the SDK. For in-depth documentation
60
+ that includes details on how to install and use the Atlas Device SDK more
61
+ generally,
59
62
check out the SDK docs:
60
63
61
64
- :ref:`C++ SDK <cpp-intro>`
@@ -67,56 +70,55 @@ check out the SDK docs:
67
70
- :ref:`React Native SDK <react-native-intro>`
68
71
- :ref:`Swift SDK <ios-intro>`
69
72
70
- .. note::
73
+ .. note:: Using Device Sync with the Realm JS WebAssembly SDK
71
74
72
- The Realm Web SDK does not currently support Realm Database or Atlas Device Sync.
73
- However, you can query the same data in an Atlas cluster using
75
+ For more information on building realtime web apps for the browser with the
76
+ Realm Database API and Atlas Device Sync, check out :ref:`<web-sync>`.
77
+ Or you can query the same data in an Atlas cluster using
74
78
:ref:`MongoDB Data Access <web-mongodb-data-access>`.
75
79
76
80
Define Data Model
77
81
~~~~~~~~~~~~~~~~~
78
82
79
- A synced realm uses object models that you define to determine the type of
80
- objects in the realm . Additionally, Sync requires a server-side document schema
81
- for each synced object type so that App Services can translate and apply changes
82
- between synced realms and MongoDB Atlas.
83
+ A synced database uses object models that you define to determine the type of
84
+ objects in the database . Additionally, Sync requires a server-side document schema
85
+ for each synced object type so the server can translate and apply changes
86
+ between synced databases and MongoDB Atlas.
83
87
84
88
To define your synced object models, do one of the following for each object
85
89
type:
86
90
87
91
- **Sync object models from an SDK:** In :ref:`Development Mode
88
- <development-mode>`, App Services automatically generates a document schema
92
+ <development-mode>`, you can automatically generate a document schema
89
93
for each synced object type and assigns that schema to a collection in the
90
94
linked cluster with the same name as the object type. Development mode lets
91
95
you configure your synced data model from a client application using the same
92
96
object models and code that you use in your production app. This is useful if
93
97
you prefer a client-first approach that uses idiomatic object models in your
94
98
preferred programming language.
95
-
96
- For a walkthrough of how to turn on Development Mode, see :ref:`Enable
97
- Development Mode <development-mode>`.
98
-
99
- - **Generate object models from a document schema:** App Services can automatically
100
- generate language-specific object models that you can use in your client
101
- applications. The generated models match the document schemas defined for your
102
- app's synced cluster. You can define these schemas manually or App Services can
103
- sample existing data in the cluster to create them automatically. This is
104
- useful if you prefer a server-first approach and/or plan to build apps with
105
- multiple SDKs.
106
-
107
- For a walkthrough of how to generate your object models based on server-side
108
- document schemas, see :ref:`Generate SDK Object Models
109
- <generate-sdk-object-models>`.
110
-
99
+
100
+ To get started, check out :ref:`create-sync-schema`.
101
+
102
+ - **Generate object models from a document schema:** If you already have data in
103
+ Atlas, you can automatically generate language-specific object models that
104
+ match the document schemas defined for your app's synced cluster. You can
105
+ define these schemas manually or App Services can sample existing data in the
106
+ cluster to create them automatically. This is useful if you prefer a
107
+ server-first approach or plan to build apps with multiple SDKs.
108
+
109
+ For a walkthrough of how to generate object models that you can use in your
110
+ client applications, see
111
+ :ref:`Generate SDK Object Models<generate-sdk-object-models>`.
112
+
111
113
Once you have the generated object models, you can copy them directly into
112
114
your client application and use them the same way you would any regular object
113
115
or struct in your preferred programming language.
114
116
115
117
Define Data Access Patterns
116
118
---------------------------
117
119
118
- Once you have decided on your app's data model, you can define a data access
119
- pattern and access rules for your app's data.
120
+ Once you have decided on your app's data model, you can define a data access
121
+ pattern and access rules for your app's data.
120
122
121
123
Client applications can query the queryable fields of a document to determine
122
124
which objects to sync. Then, App Services applies rules and default roles to
@@ -125,11 +127,11 @@ determine whether users can read or write the objects that match the query.
125
127
Define Data Access Rules
126
128
~~~~~~~~~~~~~~~~~~~~~~~~
127
129
128
- Data access rules determine which data to sync, as well as each user's
129
- ability to read and write data. Rules are closely linked to your app's data
130
+ Data access rules determine which data to sync, as well as each user's
131
+ ability to read and write data. Rules are closely linked to your app's data
130
132
model.
131
133
132
- With Flexible Sync, you specify which data to sync through queries for matching
134
+ With Device Sync, you specify which data to sync through queries for matching
133
135
objects in a client application. App Services then evaluates :ref:`roles and
134
136
rules <flexible-sync-roles>` to determine which of those matching objects a user
135
137
can read and write.
@@ -139,11 +141,11 @@ write permissions when more specific roles do not apply. Default roles apply to
139
141
all collections an App can access, but you can restrict a role to a specific
140
142
collection by specifying the collection name.
141
143
142
- Enable Sync
143
- ~~~~~~~~~~~
144
+ Configure Sync
145
+ ~~~~~~~~~~~~~~~
144
146
145
- When you enable Sync, you specify how clients can access data in your App.
146
- For a walkthrough of how to turn on sync , refer to :ref:`enable-sync`.
147
+ Device Sync lets you specify how clients can access data in your App.
148
+ For a walkthrough of how to enable and configure Sync , refer to :ref:`enable-sync`.
147
149
148
150
Optimize Sync Data Usage
149
151
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -165,22 +167,23 @@ our guide to :ref:`Optimize Device Sync Atlas Usage
165
167
Create Queries in Your Client Application
166
168
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167
169
168
- With Flexible Sync enabled, you can start creating queries from your client
169
- application.
170
+ With Device Sync enabled, you can start creating queries from your client
171
+ application.
170
172
171
- The Realm SDKs provide methods to create, update, and remove queries from the
173
+ The Atlas Device SDK provide methods to create, update, and remove queries from the
172
174
client application. The SDKs use **subscriptions** to maintain those queries on
173
175
the client side. Through these subscriptions, your applications sync objects
174
176
with the backend app and can watch for and react to changes.
175
177
176
- To create queries from your client application, refer to the Realm SDK documentation:
178
+ To create queries from your client application, refer to the Atlas Device SDK
179
+ documentation in your preferred programming language:
177
180
178
- - :ref:`Flexible Sync - Flutter SDK <flutter-sync>`
179
- - :ref:`Flexible Sync - Java SDK<java-flexible-sync>`
180
- - :ref:`Flexible Sync - Kotlin SDK <kotlin-subscriptions>`
181
- - :ref:`Flexible Sync - .NET SDK <dotnet-flexible-sync>`
182
- - :ref:`Flexible Sync - Node.js SDK <node-flexible-sync>`
183
- - :ref:`Flexible Sync - React Native SDK <react-native-flexible-sync>`
184
- - :ref:`Flexible Sync - Swift SDK <ios-flexible-sync>`
181
+ - :ref:`Flutter SDK <flutter-sync>`
182
+ - :ref:`Java SDK<java-flexible-sync>`
183
+ - :ref:`Kotlin SDK <kotlin-subscriptions>`
184
+ - :ref:`.NET SDK <dotnet-flexible-sync>`
185
+ - :ref:`Node.js SDK <node-flexible-sync>`
186
+ - :ref:`React Native SDK <react-native-flexible-sync>`
187
+ - :ref:`Swift SDK <ios-flexible-sync>`
185
188
186
189
.. include:: /includes/important-sync-ignores-custom-collation.rst
0 commit comments