You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/mongodb/vcore/quickstart-cross-region-replica-portal.md
+62-48Lines changed: 62 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,7 +118,7 @@ You can also select add 0.0.0.0 - 255.255.255.255 firewall rule to allow not jus
118
118
119
119
## Connect to primary cluster and ingest data
120
120
121
-
Get the connection string you need to connect to this primary cluster using your application code.
121
+
Get the connection string you need to connect to the primary (read-write) cluster in the Azure portal.
122
122
123
123
1. From the Azure Cosmos DB for MongoDB vCore primary cluster page, select the **Connection strings** navigation menu option under **Settings**.
124
124
@@ -129,68 +129,72 @@ Get the connection string you need to connect to this primary cluster using your
129
129
> [!IMPORTANT]
130
130
> The connection string in the portal does not include the username and password values. You must replace the `<user>` and `<password>` placeholders with the credentials you entered when you created the cluster.
131
131
132
-
1. In MongoDB shell, connect to the primary cluster using the connection string.
132
+
1. In command line, use the MongoDB shell to connect to the primary cluster using the connection string.
1. Create a *my_script.js* script file to run from the MongoDB shell. This script file creates two collections and inserts documents with data into those collections.
138
+
### Ingest data
139
+
140
+
Create a *my_script.js* script file to run from the MongoDB shell.
139
141
140
142
```JavaScript
141
-
let dogDocs = [
142
-
{
143
-
name:"pooch",
144
-
breed:"poodle",
145
-
weight:"6 lbs"
146
-
},
147
-
{
148
-
name:"mutt",
149
-
breed:"bulldog",
150
-
weight:"10 lbs"
151
-
}
152
-
];
153
-
154
-
let catDocs = [
155
-
{
156
-
name:"minni",
157
-
breed:"persian",
158
-
color:"white"
159
-
},
160
-
{
161
-
name:"tinkle",
162
-
breed:"bombay",
163
-
color:"black"
164
-
}
165
-
];
166
-
167
-
let dogIndex = { name :1 };
168
-
let catIndex = { name :1 };
169
-
170
-
let collInfoObjs = [
171
-
{ coll:"dogs", data: dogDocs, index: dogIndex },
172
-
{ coll:"cats", data: catDocs, index: catIndex }
173
-
];
174
-
175
-
for (obj of collInfoObjs) {
176
-
db[obj.coll].insertMany(obj.data);
177
-
db[obj.coll].createIndex(obj.index);
178
-
}
143
+
let dogDocs = [
144
+
{
145
+
name:"pooch",
146
+
breed:"poodle",
147
+
weight:"6 lbs"
148
+
},
149
+
{
150
+
name:"mutt",
151
+
breed:"bulldog",
152
+
weight:"10 lbs"
153
+
}
154
+
];
155
+
156
+
let catDocs = [
157
+
{
158
+
name:"minni",
159
+
breed:"persian",
160
+
color:"white"
161
+
},
162
+
{
163
+
name:"tinkle",
164
+
breed:"bombay",
165
+
color:"black"
166
+
}
167
+
];
168
+
169
+
let dogIndex = { name :1 };
170
+
let catIndex = { name :1 };
171
+
172
+
let collInfoObjs = [
173
+
{ coll:"dogs", data: dogDocs, index: dogIndex },
174
+
{ coll:"cats", data: catDocs, index: catIndex }
175
+
];
176
+
177
+
for (obj of collInfoObjs) {
178
+
db[obj.coll].insertMany(obj.data);
179
+
db[obj.coll].createIndex(obj.index);
180
+
}
179
181
```
180
182
181
-
1. Run the script from the MongoDB shell.
183
+
This script file creates two collections and inserts documents with data into those collections.
184
+
185
+
Run the script from the MongoDB shell.
182
186
183
187
```MongoDB Shell
184
188
load(my_script.js);
185
189
```
186
190
187
-
1.In the MongoDB shell, read data from the database.
191
+
In the MongoDB shell, read data from the database.
188
192
189
193
```MongoDB Shell
190
194
db.dogs.find();
191
195
db.cats.find();
192
196
```
193
-
197
+
194
198
## Connect to read replica cluster in another region and read data
195
199
196
200
Get the connection string for the read cluster replica in another region.
@@ -199,20 +203,30 @@ Get the connection string for the read cluster replica in another region.
199
203
200
204
:::image type="content" source="media/quickstart-cross-region-replication/global-distribution-page-on-primary-cluster.png" alt-text="Screenshot of the global distribution preview page in the primary cluster propteries.":::
201
205
202
-
1. Select the cluster replica name to open the read cluster replica properties in the Azure portal.
206
+
1. Select *cluster replica name* to open the read cluster replica properties in the Azure portal.
203
207
204
208
1. On the replica cluster sidebar, under **Cluster management**, select **Connection strings**.
205
209
206
210
1. Copy the value from the **Connection string** field.
207
211
208
212
> [!IMPORTANT]
209
-
> The connection string in the portal does not include the username and password values. You must replace the `<user>` and `<password>` placeholders with the credentials you entered when you created the cluster.
213
+
> The connection string of the read replica cluster in the portal contains unique replica cluster name that you selected during replica creation. The username and password values for the read replica cluster are always the same as the ones on its primary cluster.
210
214
211
-
1. In MongoDB shell, connect to the read replica cluster using its connection string.
215
+
1. In command line, use the MongDB shell to connect to the read replica cluster using its connection string.
0 commit comments