Skip to content

Commit 74048eb

Browse files
author
Mohammad Hunan Chughtai
authored
(DOCSP-12596) JS Initialize Realm App (#532)
* (DOCSP-12596): Initialize a Realm App for Node * added rn page * (DOCSP-12596): added web & rn init realm client files * fixed api method Realm.App.getApp -> Realm.getApp
1 parent 5414037 commit 74048eb

File tree

8 files changed

+310
-7
lines changed

8 files changed

+310
-7
lines changed

source/android/init-realmclient.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Initialize the Realm App Client
99
Overview
1010
--------
1111

12-
The {+service-short+} {+app+} client is the interface to the {+backend+}
12+
The {+app+} client is the interface to the {+backend+}
1313
backend. It provides access to the :ref:`authentication functionality
1414
<android-authenticate>`, :ref:`functions <android-call-a-function>`, and
1515
:ref:`sync management <android-sync-data>`.
@@ -21,8 +21,9 @@ backend. It provides access to the :ref:`authentication functionality
2121
Access the App Client
2222
---------------------
2323

24-
Pass the {+app+} ID for your {+app+}, which you can find in the {+ui+}.
25-
24+
Pass the {+app+} ID for your {+app+}, which you can :ref:`find in the Realm
25+
UI <find-your-app-id>`.
26+
2627
.. tabs-realm-languages::
2728

2829
.. tab::

source/ios/init-realmclient.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Initialize the Realm App Client
99
Overview
1010
--------
1111

12-
The {+service-short+} {+app+} client is the interface to the {+backend+}
12+
The {+app+} client is the interface to the {+backend+}
1313
backend. It provides access to the :ref:`authentication functionality
1414
<ios-authenticate>`, :ref:`functions <ios-call-a-function>`, and
1515
:ref:`sync management <ios-sync-data>`.
@@ -19,12 +19,12 @@ backend. It provides access to the :ref:`authentication functionality
1919
Access the App Client
2020
---------------------
2121

22-
Pass the {+app+} ID for your {+app+}, which you can find in the {+ui+}.
22+
Pass the {+app+} ID for your {+app+}, which you can :ref:`find in the Realm
23+
UI <find-your-app-id>`.
2324

2425
.. code-block:: swift
2526

26-
let app = App(id: "my-realm-app-id")
27-
27+
let app = App(id: "<Your App ID>") // replace this with your App ID
2828

2929
.. _ios-app-client-configuration:
3030

source/node.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ To learn how to query for data in MongoDB with the Node.js SDK, see
120120
:caption: Work with MongoDB Realm
121121
:hidden:
122122

123+
Initialize the App Client </node/init-realmclient>
123124
Authenticate a User </node/authenticate>
124125
Manage Email/Password Users </node/manage-email-password-users>
125126
Create & Manage User API Keys </node/create-manage-api-keys>

source/node/init-realmclient.txt

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
.. _node-init-appclient:
2+
3+
===============================
4+
Initialize the Realm App Client
5+
===============================
6+
7+
.. default-domain:: mongodb
8+
9+
Overview
10+
--------
11+
12+
The {+app+} client is the interface to the {+backend+}
13+
backend. It provides access to the :ref:`authentication functionality
14+
<ios-authenticate>`, :ref:`functions <ios-call-a-function>`, and
15+
:ref:`sync management <ios-sync-data>`.
16+
17+
18+
.. _node-access-the-app-client:
19+
20+
Access the App Client
21+
---------------------
22+
23+
Pass the {+service+} App ID for your {+app+}, which you can :ref:`find in the Realm UI <find-your-app-id>`.
24+
25+
.. tabs-realm-languages::
26+
27+
.. tab::
28+
:tabid: typescript
29+
30+
.. code-block:: typescript
31+
32+
const id = "<Your App ID>"; // replace this with your App ID
33+
34+
.. tab::
35+
:tabid: javascript
36+
37+
.. code-block:: javascript
38+
39+
const id = "<Your App ID>"; // replace this with your App ID
40+
41+
.. _node-app-client-configuration:
42+
43+
Configuration
44+
-------------
45+
46+
To set up your {+app+} client, pass a configuration object to an instance
47+
of ``Realm.App``.
48+
49+
.. tabs-realm-languages::
50+
51+
.. tab::
52+
:tabid: typescript
53+
54+
.. code-block:: typescript
55+
56+
const config = {
57+
id,
58+
};
59+
const app: Realm.App = new Realm.App(config);
60+
61+
.. tab::
62+
:tabid: javascript
63+
64+
.. code-block:: javascript
65+
66+
const config = {
67+
id,
68+
};
69+
const app = new Realm.App(config);
70+
71+
.. note::
72+
73+
``id`` is a required field of the application configuration object. To see the full list of fields for the configuration object that ``Realm.App`` accepts as a parameter, view the :js-sdk:`App Configuration Type Definitions <Realm.App.html#~AppConfiguration>`.
74+
75+
.. _node-app-retrieve-client:
76+
77+
Retrieve an Instance of the App Client
78+
--------------------------------------
79+
80+
To retrieve an instance of the App Client from anywhere in your application, call :js-sdk:`Realm.App.getApp() <Realm.App.html#getApp>` and pass in your ``App ID``.
81+
82+
.. tabs-realm-languages::
83+
84+
.. tab::
85+
:tabid: typescript
86+
87+
.. code-block:: typescript
88+
89+
const app: Realm.App = Realm.App.getApp("<Your App ID>"); // replace this with your App ID
90+
91+
.. tab::
92+
:tabid: javascript
93+
94+
.. code-block:: javascript
95+
96+
const app = Realm.App.getApp("<Your App ID>"); // replace this with your App ID
97+
98+
99+

source/react-native.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ MongoDB Data Access <react-native-mongodb-data-access>`.
124124
:caption: Work with MongoDB Realm
125125
:hidden:
126126

127+
Initialize the Realm App Client </react-native/init-realmclient>
127128
Authenticate a User </react-native/authenticate>
128129
Manage Email/Password Users </react-native/manage-email-password-users>
129130
Create & Manage User API Keys </node/create-manage-api-keys>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
.. _react-native-init-appclient:
2+
3+
===============================
4+
Initialize the Realm App Client
5+
===============================
6+
7+
.. default-domain:: mongodb
8+
9+
Overview
10+
--------
11+
12+
The {+app+} client is the interface to the {+backend+}
13+
backend. It provides access to the :ref:`authentication functionality
14+
<ios-authenticate>`, :ref:`functions <ios-call-a-function>`, and
15+
:ref:`sync management <ios-sync-data>`.
16+
17+
18+
.. _react-native-access-the-app-client:
19+
20+
Access the App Client
21+
---------------------
22+
23+
Pass the {+service+} App ID for your {+app+}, which you can :ref:`find in the Realm UI <find-your-app-id>`.
24+
25+
.. tabs-realm-languages::
26+
27+
.. tab::
28+
:tabid: typescript
29+
30+
.. code-block:: typescript
31+
32+
const id = "<Your App ID>"; // replace this with your App ID
33+
34+
.. tab::
35+
:tabid: javascript
36+
37+
.. code-block:: javascript
38+
39+
const id = "<Your App ID>"; // replace this with your App ID
40+
41+
.. _react-native-client-configurations:
42+
43+
Configuration
44+
-------------
45+
46+
To set up your {+app+} client, pass a configuration object to an instance
47+
of ``Realm.App``.
48+
49+
.. tabs-realm-languages::
50+
51+
.. tab::
52+
:tabid: typescript
53+
54+
.. code-block:: typescript
55+
56+
const config = {
57+
id,
58+
};
59+
const app: Realm.App = new Realm.App(config);
60+
61+
.. tab::
62+
:tabid: javascript
63+
64+
.. code-block:: javascript
65+
66+
const config = {
67+
id,
68+
};
69+
const app = new Realm.App(config);
70+
71+
.. note::
72+
73+
``id`` is a required field of the application configuration object. To see the full list of fields for the configuration object that ``Realm.App`` accepts as a parameter, view the :js-sdk:`App Configuration Type Definitions <Realm.App.html#~AppConfiguration>`.
74+
75+
76+
.. _react-native-app-retrieve-client:
77+
78+
Retrieve an Instance of the App Client
79+
--------------------------------------
80+
81+
To retrieve an instance of the App Client from anywhere in your application, call :js-sdk:`Realm.App.getApp() <Realm.App.html#getApp>` and pass in your ``App ID``.
82+
83+
.. tabs-realm-languages::
84+
85+
.. tab::
86+
:tabid: typescript
87+
88+
.. code-block:: typescript
89+
90+
const app: Realm.App = Realm.App.getApp("<Your App ID>"); // replace this with your App ID
91+
92+
.. tab::
93+
:tabid: javascript
94+
95+
.. code-block:: javascript
96+
97+
const app = Realm.App.getApp("<Your App ID>"); // replace this with your App ID
98+
99+
100+

source/web.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ TypeScript applications.
3636
:caption: Work with MongoDB Realm
3737
:hidden:
3838

39+
Initialize the Realm App Client </web/init-realmclient>
3940
Authenticate a User </web/authenticate>
4041
Manage Email/Password Users </web/manage-email-password-users>
4142
Create & Manage User API Keys </node/create-manage-api-keys>

source/web/init-realmclient.txt

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
.. _web-init-appclient:
2+
3+
===============================
4+
Initialize the Realm App Client
5+
===============================
6+
7+
.. default-domain:: mongodb
8+
9+
Overview
10+
--------
11+
12+
The {+app+} client is the interface to the {+backend+}
13+
backend. It provides access to the :ref:`authentication functionality
14+
<ios-authenticate>`, :ref:`functions <ios-call-a-function>`, and
15+
:ref:`sync management <ios-sync-data>`.
16+
17+
18+
.. _web-access-the-app-client:
19+
20+
Access the App Client
21+
---------------------
22+
23+
Pass the {+service+} App ID for your {+app+}, which you can :ref:`find in the Realm UI <find-your-app-id>`.
24+
25+
.. tabs-realm-languages::
26+
27+
.. tab::
28+
:tabid: typescript
29+
30+
.. code-block:: typescript
31+
32+
const id = "<Your App ID>"; // replace this with your App ID
33+
34+
.. tab::
35+
:tabid: javascript
36+
37+
.. code-block:: javascript
38+
39+
const id = "<Your App ID>"; // replace this with your App ID
40+
41+
.. _web-client-configurations:
42+
43+
Configuration
44+
-------------
45+
46+
To set up your {+app+} client, pass a configuration object to an instance
47+
of ``Realm.App``.
48+
49+
.. tabs-realm-languages::
50+
51+
.. tab::
52+
:tabid: typescript
53+
54+
.. code-block:: typescript
55+
56+
const config = {
57+
id,
58+
};
59+
const app: Realm.App = new Realm.App(config);
60+
61+
.. tab::
62+
:tabid: javascript
63+
64+
.. code-block:: javascript
65+
66+
const config = {
67+
id,
68+
};
69+
const app = new Realm.App(config);
70+
71+
.. note::
72+
73+
``id`` is a required field of the application configuration object. To see the full list of fields for the configuration object that ``Realm.App`` accepts as a parameter, view the :js-sdk:`App Configuration Type Definitions <Realm.App.html#~AppConfiguration>`.
74+
75+
76+
.. _web-app-retrieve-client:
77+
78+
Retrieve an Instance of the App Client
79+
--------------------------------------
80+
81+
To retrieve an instance of the App Client from anywhere in your application, call :js-sdk:`Realm.App.getApp() <Realm.App.html#getApp>` and pass in your ``App ID``.
82+
83+
.. tabs-realm-languages::
84+
85+
.. tab::
86+
:tabid: typescript
87+
88+
.. code-block:: typescript
89+
90+
const app: Realm.App = Realm.getApp("<Your App ID>"); // replace this with your App ID
91+
92+
.. tab::
93+
:tabid: javascript
94+
95+
.. code-block:: javascript
96+
97+
const app = Realm.getApp("<Your App ID>"); // replace this with your App ID
98+
99+
100+

0 commit comments

Comments
 (0)