Skip to content

Commit e2b4467

Browse files
authored
Merge branch 'feature-consolidated-sdk-docs' into DOCSP-39514
2 parents f8f71d7 + 6ffd8b5 commit e2b4467

File tree

161 files changed

+4526
-94
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+4526
-94
lines changed

source/help.txt

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,33 @@
44
Get Help
55
========
66

7+
.. meta::
8+
:description: Get help for Atlas Device SDK through community forums, sharing feedback, or professional support.
9+
:keywords: Realm, C++ SDK, Flutter SDK, Kotlin SDK, Java SDK, .NET SDK, Node.js SDK, Swift SDK
10+
11+
.. facet::
12+
:name: genre
13+
:values: reference
14+
15+
.. facet::
16+
:name: programming_language
17+
:values: cpp, csharp, dart, java, javascript/typescript, kotlin, objective-c, swift
18+
719
.. contents:: On this page
820
:local:
921
:backlinks: none
10-
:depth: 1
22+
:depth: 2
1123
:class: singlecol
1224

13-
Overview
14-
--------
25+
.. tabs-selector:: drivers
26+
27+
MongoDB provides various resources for getting help with Atlas Device SDK and
28+
Atlas App Services.
29+
30+
.. tip:: Atlas Device SDK and Realm
1531

16-
MongoDB provides various resources for getting help with Atlas App Services.
32+
While the SDK has been renamed to Atlas Device SDK, some resources still
33+
reflect ``Realm`` naming.
1734

1835
Professional Support
1936
--------------------
@@ -35,9 +52,9 @@ Community Forums
3552
The official `MongoDB Community Forums
3653
<https://www.mongodb.com/community/forums/c/realm/9>`__ are a great
3754
place to meet other developers, ask and answer questions, and stay
38-
up-to-date with the latest Realm and App Services features and releases. You can also
39-
interact with MongoDB employees, like our community team, engineers, and
40-
product managers, who are active forum contributors.
55+
up-to-date with the latest Atlas Device SDK and App Services features and
56+
releases. You can also interact with MongoDB employees, like our community
57+
team, engineers, and product managers, who are active forum contributors.
4158

4259
Stack Overflow
4360
--------------
@@ -68,62 +85,56 @@ at the bottom right or right side of the page.
6885
Bug Reporting, and Changelogs
6986
-----------------------------
7087

71-
.. tabs-realm-sdks::
88+
You can report bugs or view the changelog in the relevant ``realm-SDK``
89+
repository in GitHub. While the SDK has been renamed to Atlas Device SDK, the
90+
GitHub repositories still reflect ``realm`` naming.
7291

73-
.. tab::
74-
:tabid: android
75-
76-
For the Java SDK:
77-
78-
- :github:`Report a bug <realm/realm-java/issues/new?template=bug_report.md>`
79-
- :github:`View the changelog <realm/realm-java/blob/master/CHANGELOG.md>`
92+
.. tabs-drivers::
8093

8194
.. tab::
82-
:tabid: ios
95+
:tabid: cpp-sdk
8396

84-
For the Swift SDK:
85-
86-
- :github:`Report a bug <realm/realm-swift/issues/new>`
87-
- :github:`View the changelog <realm/realm-swift/blob/master/CHANGELOG.md>`
97+
- :github:`Report a bug <realm/realm-cpp/issues/new>`
98+
- :github:`View the changelog <realm/realm-cpp/blob/master/CHANGELOG.md>`
8899

89100
.. tab::
90-
:tabid: dotnet
91-
92-
For the .NET SDK:
101+
:tabid: csharp
93102

94103
- :github:`Report a bug <realm/realm-dotnet/issues/new>`
95104
- :github:`View the changelog <realm/realm-dotnet/blob/master/CHANGELOG.md>`
105+
106+
.. tab::
107+
:tabid: dart
108+
109+
- :github:`Report a bug <realm/realm-dart/issues/new>`
110+
- :github:`View the changelog <realm/realm-dart/blob/master/CHANGELOG.md>`
96111

97112
.. tab::
98113
:tabid: javascript
99114

100-
For the Node.js, React Native, or Web SDKs:
101-
102115
- :github:`Report a bug <realm/realm-js/issues/new>`
103116
- :github:`View the changelog <realm/realm-js/blob/master/CHANGELOG.md>`
104117

105-
.. tab::
106-
:tabid: flutter
107-
108-
For the Flutter SDK:
109-
110-
- :github:`Report a bug <realm/realm-dart/issues/new>`
111-
- :github:`View the changelog <realm/realm-dart/blob/master/CHANGELOG.md>`
112-
113118
.. tab::
114119
:tabid: kotlin
115120

116-
For the Kotlin SDK:
117-
118121
- :github:`Report a bug <realm/realm-kotlin/issues/new>`
119122
- :github:`View the changelog <realm/realm-kotlin/blob/master/CHANGELOG.md>`
120123

121124
.. tab::
122-
:tabid: cpp
125+
:tabid: objectivec
123126

124-
For the C++ SDK:
127+
- :github:`Report a bug <realm/realm-swift/issues/new>`
128+
- :github:`View the changelog <realm/realm-swift/blob/master/CHANGELOG.md>`
125129

126-
- :github:`Report a bug <realm/realm-cpp/issues/new>`
127-
- :github:`View the changelog <realm/realm-cpp/blob/master/CHANGELOG.md>`
130+
.. tab::
131+
:tabid: swift
132+
133+
- :github:`Report a bug <realm/realm-swift/issues/new>`
134+
- :github:`View the changelog <realm/realm-swift/blob/master/CHANGELOG.md>`
128135

129-
136+
.. tab::
137+
:tabid: typescript
138+
139+
- :github:`Report a bug <realm/realm-js/issues/new>`
140+
- :github:`View the changelog <realm/realm-js/blob/master/CHANGELOG.md>`
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
C++ does not currently provide a method to delete all objects in the database.
2+
You can manually iterate through the objects and delete them if you need to
3+
clear the database.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C++ does not currently provide an API to delete all objects of a type.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
In this example, a ``Person`` has a to-one relationship to a ``Dog``,
2+
and the ``Dog`` has an inverse relationship to ``Person``.
3+
Setting the ``Person.dog`` relationship to ``nullptr`` removes the inverse
4+
relationship from the ``Dog`` object.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You can delete multiple objects within a write transaction.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
1. Open a write transaction with :cpp-sdk:`db.write()
2+
<structrealm_1_1db.html>`.
3+
4+
#. Pass the object(s) you want to delete into the write block, or query for
5+
them inside the block.
6+
7+
.. important:: Objects Must Be Live
8+
9+
You can only delete live objects. If you are working with a frozen
10+
object or thread-safe reference, you must ``thaw()`` the object or
11+
``resolve()`` the thread-safe reference before deleting the object.
12+
For more details, refer to :ref:`sdks-threading`.
13+
14+
#. Call the ``remove()`` method with the object you want to delete as an
15+
argument.
16+
17+
#. The specified objects are deleted from the database and can no longer be
18+
accessed or modified. If you try to use a deleted object, the SDK throws an
19+
error.
20+
21+
If any deleted objects had a relationship with another object, the SDK
22+
only deletes the reference to the other object. The referenced object
23+
remains in the database, but it can no longer be queried through the deleted
24+
parent property. Refer to the :ref:`sdks-delete-related-objects` section
25+
for more information.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To delete an object from the database, pass the object to the
2+
:cpp-sdk:`db.remove() function <structrealm_1_1db.html>`
3+
inside of a write transaction.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To delete a :cpp-sdk:`map key
2+
<structrealm_1_1managed_3_01std_1_1map_3_01std_1_1string_00_01T_01_4_00_01void_01_4.html>`,
3+
pass the key name to ``erase()``.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
You can delete a :cpp-sdk:`list element
2+
<structrealm_1_1managed_3_01std_1_1vector_3_01T_01_5_01_4_01_4.html>`
3+
with ``erase()``, or remove all elements from the list with ``clear()``.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
You can delete a :cpp-sdk:`set element
2+
<structrealm_1_1managed_3_01std_1_1set_3_01T_01_5_01_4_01_4.html>`
3+
with ``erase()``, or remove all elements from a set with ``clear()``.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To delete an object from the database, pass the object to the
2+
:cpp-sdk:`db.remove() function <structrealm_1_1db.html>`
3+
inside of a write transaction.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
In this example, we use an Atlas Function to create the custom user data. The
2+
Function takes an object passed by the client add adds it to the custom user
3+
data collection in Atlas. The Function creates the custom user data if it
4+
doesn't already exist and replaces all data in it if it does exist.
5+
6+
.. literalinclude:: /examples/generated/cpp/updateCustomUserData.snippet.update-custom-user-data.js
7+
:language: js
8+
:caption: updateCustomUserData.js - Atlas Function running on server (JavaScript)
9+
10+
The following example :ref:`calls a function <sdks-call-function>` to
11+
insert a document containing the user ID of the currently logged in user
12+
and a ``favoriteColor`` value into the custom user data collection.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
In this example, we use an Atlas Function to delete the custom user data
2+
document. The Atlas Function does not require any arguments. The
3+
Function uses the Function context to determine the caller's user ID, and
4+
deletes the custom user data document matching the user's ID.
5+
6+
.. literalinclude:: /examples/generated/cpp/deleteCustomUserData.snippet.delete-custom-user-data.js
7+
:language: js
8+
:caption: deleteCustomUserData.js - Atlas Function running on server (JavaScript)
9+
10+
The code that calls this Function requires only a logged-in user to call
11+
the Function.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. note::
2+
3+
If you require the most recent version of custom user data, use the
4+
:cpp-sdk:`refresh_custom_user_data()
5+
<structrealm_1_1user.html#a6e08623890de4003a00a351e939a0a9f>`
6+
function to request the latest version of a user's custom data.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
To read the data, access the ``custom_data`` property on the ``User`` object
2+
of a logged-in user.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
To update a user's custom user data with an Atlas Function, edit the
2+
MongoDB document whose user ID field contains the user ID of the user.
3+
The following example calls the same function used to create the custom user
4+
data document above. Here, we update the ``favoriteColor`` field of the
5+
the document containing the user ID of the currently logged in user.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
To delete all managed objects in the database, call :dotnet-sdk:`Realm.RemoveAll
2+
<reference/Realms.Realm.html#Realms_Realm_RemoveAll>`.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
To delete all objects of a type, call :dotnet-sdk:`Realm.RemoveAll\<T\>
2+
<reference/Realms.Realm.html#Realms_Realm_RemoveAll__1>`.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
In the following example, we call :dotnet-sdk:`Realm.RemoveRange\<T\>
2+
<reference/Realms.Realm.html#Realms_Realm_RemoveRange__1_System_Linq_IQueryable___0__>`
3+
to remove Ali's ``dogs`` collection, which is a to-many list property
4+
containing one or more ``Dog`` objects. Then, we call :dotnet-sdk:`Realm.Remove()
5+
<reference/Realms.Realm.html#Realms_Realm_Remove_Realms_IRealmObjectBase_>` to
6+
delete Ali's ``Person`` object itself.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
To delete the value of a mixed property, set its value to ``Null``.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To delete multiple objects at the same time, pass an ``IQueryable<T>`` query
2+
for the objects you want to delete to :dotnet-sdk:`Realm.RemoveRange\<T\>
3+
<reference/Realms.Realm.html#Realms_Realm_RemoveRange__1_System_Linq_IQueryable___0__>`.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
1. Open a write transaction with :dotnet-sdk:`Realm.Write
2+
<reference/Realms.Realm.html#Realms_Realm_Write_System_Action_>` or
3+
:dotnet-sdk:`Realm.WriteAsync
4+
<reference/Realms.Realm.html#Realms_Realm_WriteAsync_System_Action_System_Threading_CancellationToken_>`.
5+
6+
#. Pass the object(s) you want to delete into the write block, or query for
7+
them inside the block.
8+
9+
.. important:: Objects Must Be Live
10+
11+
You can only delete live objects. If you are working with a frozen
12+
object or thread-safe reference, you must query for the live object or
13+
resolve the thread-safe reference before deleting the object. For more
14+
details, refer to :ref:`sdks-threading`.
15+
16+
#. Call the :dotnet-sdk:`Remove
17+
<reference/Realms.Realm.html#Realms_Realm_Remove_Realms_IRealmObjectBase_>`
18+
method with the object you want to delete as an argument.
19+
20+
#. The specified objects are deleted from the database and can no longer be
21+
accessed or modified. If you try to use a deleted object, the SDK throws an
22+
error.
23+
24+
If any deleted objects had a relationship with another object, the SDK
25+
only deletes the reference to the other object. The referenced object
26+
remains in the database, but it can no longer be queried through the deleted
27+
parent property. Refer to the :ref:`sdks-delete-related-objects` section
28+
for more information.
29+
30+
.. tip::
31+
32+
You can check whether an object is still valid to use by calling
33+
:dotnet-sdk:`isValid
34+
<reference/Realms.RealmObjectBase.html#Realms_RealmObjectBase_IsValid>`.
35+
Deleted objects return ``false``.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
You can only delete live objects. If you are working with a frozen object,
2+
such as when passing an object across threads, you must query for the frozen
3+
object on the new thread in order to delete it.
4+
5+
Similarly, if you're passing a :dotnet-sdk:`ThreadSafeReference
6+
<reference/Realms.ThreadSafeReference.html>` for an object you want to delete,
7+
you must resolve the reference and then delete the resovled object.
8+
9+
For more information about working with objects across threads, refer to
10+
:ref:`sdks-threading`.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You can remove dictionary keys and values within a write transaction.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
You can remove one or more elements from a list within a write transaction.
2+
3+
Deleting an object from the database will remove it from any lists
4+
where it existed. Therefore, a list of objects will never contain deleted objects.
5+
However, lists of primitive types can contain null values. If you do not
6+
want to allow null values in a list, then either use non-nullable types in
7+
the list declaration (for example, use ``IList<double>`` instead of
8+
``IList<double?>``). If you are using the older schema
9+
type definition (your classes derive from the ``RealmObject`` base class),
10+
or you do not have nullability enabled, use the ``[Required]`` attribute if
11+
the list contains nullable reference types, such as ``string`` or ``byte[]``.
12+
13+
.. important:: Not Supported with Sync
14+
15+
Non-synced databases support collections of nullable (optional) values,
16+
but synced databases do not.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
You can remove one or more elements from a set within a write transaction.
2+
3+
Deleting an object from the database will remove it from any sets
4+
in which it existed. Therefore, a set of objects will never contain null objects.
5+
However, sets of primitive types can contain null values. If you do not
6+
want to allow null values in a set, then either use non-nullable types in
7+
the set declaration (for example, use ``ISet<double>`` instead of
8+
``ISet<double?>``). If you are using the older schema
9+
type definition (your classes derive from the ``RealmObject`` base class),
10+
or you do not have nullability enabled, you will need to use the
11+
``[Required]`` attribute if the set contains nullable reference types, such as
12+
``string`` or ``byte[]``.
13+
14+
.. important:: Not Supported with Sync
15+
16+
Non-synced databases support collections of nullable (optional) values,
17+
but synced databases do not.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
To delete an object from the database, pass the object to
2+
:dotnet-sdk:`Realm.Remove()
3+
<reference/Realms.Realm.html#Realms_Realm_Remove_Realms_IRealmObjectBase_>`
4+
inside of a write transaction.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
The following example uses
2+
:ref:`MongoDB Data Access <sdks-access-mongodb>` to insert a
3+
document containing the user ID of the currently logged in user and several
4+
custom properties into the custom user data collection:
5+
6+
.. literalinclude:: /examples/generated/dotnet/CustomUserDataExamples.snippet.create.cs
7+
:language: csharp
8+
9+
You may find it helpful to create a C# class (POCO) that represents the custom
10+
user data object. The SDK will serialize/deserialize this class to and from BSON
11+
when writing, reading, and updating properties. The example above uses the
12+
following class to map the properties.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The following example uses :ref:`MongoDB Data Access <sdks-access-mongodb>` to
2+
find and deletes the data through the
3+
:dotnet-sdk:`DeleteOneAsync() <reference/Realms.Sync.MongoClient.Collection-1.html#Realms_Sync_MongoClient_Collection_1_DeleteOneAsync_System_Object_>`
4+
method.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. note::
2+
3+
If you require the most recent version of custom user data, call the
4+
:dotnet-sdk:`RefreshCustomDataAsync()
5+
<reference/Realms.Sync.User.html#Realms_Sync_User_RefreshCustomDataAsync>`
6+
method to request the latest version of a user's custom data.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To read custom user data, call the
2+
:dotnet-sdk:`GetCustomData() <reference/Realms.Sync.User.html#Realms_Sync_User_GetCustomData>`
3+
method on the ``User`` object of a logged in user.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The following example
2+
finds and updates the data by using the
3+
:dotnet-sdk:`UpdateOneAsync() <reference/Realms.Sync.MongoClient.Collection-1.html#Realms_Sync_MongoClient_Collection_1_UpdateOneAsync_System_Object_System_Object_System_Boolean_>`
4+
method, and then refreshes the data to ensure the latest changes are available.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
You can link identities using the
2+
:dotnet-sdk:`LinkCredentialsAsync() <reference/Realms.Sync.User.html#Realms_Sync_User_LinkCredentialsAsync_Realms_Sync_Credentials_>`.
3+
This links the identity belonging to the credentials to the logged-in
4+
:dotnet-sdk:`User <reference/Realms.Sync.User.html>` object.
5+
6+
.. literalinclude:: /examples/generated/dotnet/UserLinkExamples.snippet.link.cs
7+
:language: csharp
8+
9+
In the example above, we must first register the new :ref:`email/password
10+
<email-password-authentication>` user before linking. If you are using any of
11+
the other :ref:`Auth Providers <authentication-providers>`, this step is
12+
unnecessary. The following example uses :ref:`Google authentication
13+
<google-authentication>` instead of EmailPassword.

0 commit comments

Comments
 (0)