-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathcpp.txt
227 lines (165 loc) · 7.3 KB
/
cpp.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
.. meta::
:robots: noindex, nosnippet
:template: product-landing
:hidefeedback: header
:noprevnext:
.. _cpp-intro:
.. _cpp-realm-database:
========================
Atlas Device SDK for C++
========================
.. meta::
:description: Use Atlas Device SDK for C++ to write applications that access data stored locally on devices and sync data with Atlas.
.. toctree::
:titlesonly:
Model Data </sdk/cpp/model-data>
Realm Files </sdk/cpp/realm-files>
CRUD </sdk/cpp/crud/>
React to Changes </sdk/cpp/react-to-changes>
Application Services </sdk/cpp/application-services>
Manage Users </sdk/cpp/manage-users>
Sync Data </sdk/cpp/sync>
Logging </sdk/cpp/logging>
SDK Telemetry </sdk/cpp/telemetry>
GitHub <https://github.com/realm/realm-cpp>
API Reference (Doxygen) <https://www.mongodb.com/docs/realm-sdks/cpp/latest/>
Example Projects <https://github.com/realm/realm-cpp/tree/main/examples>
Release Notes <https://github.com/realm/realm-cpp/releases>
Use Atlas Device SDK for C++ to write applications that access data
stored locally on devices and sync data with Atlas.
.. kicker:: Learning Paths
Get Started with the C++ SDK
-----------------------------
.. card-group::
:columns: 3
:style: extra-compact
.. card::
:headline: Quick Start
:cta: See Code Examples
:url: https://www.mongodb.com/docs/realm/sdk/cpp/quick-start/
:icon: atlas_functions
:icon-alt: Functions Icon
Minimal-explanation code examples of how to work with the C++ SDK,
write to the device database, and sync with other devices.
.. card::
:headline: Working Example App
:cta: Explore an Example App
:url: https://www.mongodb.com/docs/atlas/app-services/template-apps/
:icon: realm_mobile
:icon-alt: Atlas Device SDK Mobile Icon
Learn from a working terminal GUI client app that
uses the C++ SDK.
.. card::
:headline: Guided Tutorial
:cta: Follow the Tutorial
:url: https://mongodb.com/docs/atlas/app-services/tutorial/cpp/
:icon: general_content_tutorial
:icon-alt: Tutorial Icon
Follow a guided tutorial to learn how to adapt the example app to
create your own working app.
.. kicker:: What You Can Do
Develop Apps with the SDK
-------------------------
Use the SDK's open-source database - Realm - as an object store on the device.
Use Device Sync to keep data in sync with your MongoDB Atlas cluster and
other clients.
.. tabs::
.. tab:: Store Data with the SDK
:tabid: device-persistence
.. procedure::
.. step:: Install the C++ SDK
Use Swift Package Manager or Cmake to :ref:`cpp-install`
in your project.
Include the header in the translation unit where you want to
use it to get started.
.. step:: Define an Object Schema
Use C++ to idiomatically :ref:`define an object type
<cpp-define-a-new-object-type>`.
.. step:: Open a Database
The SDK's database - Realm - stores objects in files on your device.
:ref:`Configure and open a database <cpp-configure-and-open-a-realm>`
to get started reading and writing data.
.. step:: Read and Write Data
:ref:`Create <cpp-crud-create>`, :ref:`read <cpp-crud-read>`,
:ref:`update <cpp-crud-update>`, and :ref:`delete <cpp-crud-delete>`
objects from the database. Filter data using the SDK's
:ref:`query engine <cpp-filter-data>`.
.. step:: React to Changes
Live objects mean that your data is always up-to-date.
You can :ref:`register a notification handler <cpp-react-to-changes>`
to watch for changes and perform some logic, such as updating
your UI.
.. image:: /images/illustrations/2024_branding/Technical_SOFTWARE_Connect(2)_Spot.png
:alt: Atlas Device SDK Mobile Illustration
.. tab:: Sync Data Across Devices
:tabid: device-sync
.. procedure::
.. step:: Connect to an Atlas App Services App
Configure :ref:`Device Sync in an App Services App
<realm-sync-get-started>`. Define data access rules. Use
Development Mode to infer your schema from your C++ data
model.
Then, :ref:`connect to the backend <cpp-connect-to-backend>` from
your client.
.. step:: Authenticate a User
Use one of our authentication providers to :ref:`authenticate a
user <cpp-authenticate-users>`. App Services provides access
to popular authentication providers, such as Apple, Google, or
Facebook. Use our built-in email/password provider to manage
users without a third-party, or use custom JWT authentication to
integrate with other authentication providers. Anonymous authentication
provides access without requiring a login or persisting user data.
.. step:: Open a Synced Database
:ref:`Configure and open a synced database <cpp-open-synced-realm>`.
:ref:`Subscribe to a query <cpp-manage-flexible-sync-subscriptions>`
to determine what data the synced database can read and write.
.. step:: Read and Write Synced Data
The APIs to read and write data are the same whether you're using
a synced or non-synced database. Data that you read and write to
the device is automatically kept in sync with your Atlas
cluster and other clients. Apps keep working offline and
deterministically sync changes whenever a network connection is
available.
.. image:: /images/illustrations/2024_branding/Technical_SOFTWARE_Sync(2)_Spot.png
:alt: Device Sync Illustration
.. tab:: Build with Atlas App Services
:tabid: app-services
.. container::
Call Serverless Functions
~~~~~~~~~~~~~~~~~~~~~~~~~
You can :ref:`call serverless Functions <cpp-call-a-function>`
from your client application that run in an App Services backend.
Authenticate Users
~~~~~~~~~~~~~~~~~~
Authenticate users with built-in and third-party :ref:`authentication
providers <cpp-authenticate-users>`. Use the authenticated user to
access App Services.
.. image:: /images/illustrations/2024_branding/Technical_ACTION_WrenchSettings_Spot.png
:alt: App Services Illustration
.. kicker:: Essential Documentation
Recommended Reading
-------------------
.. card-group::
:columns: 3
:style: extra-compact
.. card::
:headline: Quick Start
:cta: See Code Examples
:url: https://www.mongodb.com/docs/realm/sdk/cpp/quick-start/
:icon: atlas_functions
:icon-alt: Functions Icon
Minimal-explanation code examples of how to work with the SDK.
.. card::
:headline: C++ API Reference
:cta: C++ SDK Reference
:url: https://www.mongodb.com/docs/realm-sdks/cpp/latest
:icon: realm_sdk
:icon-alt: SDK Icon
Explore generated Doxygen reference docs for the C++ APIs.
.. card::
:headline: C++ SDK on GitHub
:cta: C++ SDK Repository
:url: https://github.com/realm/realm-cpp
:icon: realm_sdk
:icon-alt: SDK Icon
Explore the C++ SDK on GitHub.