Skip to content

Commit 753ba67

Browse files
author
Chris Cho
authored
DOCSP-9029: remove retryWrites from uri connection string (#68)
* DOCSP-9029: remove retryWrites from uri connection string
1 parent 2920ab2 commit 753ba67

31 files changed

+41
-66
lines changed

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!make
22
MAKEFLAGS += --silent
33

4-
# This allows us to accept extra arguments (by doing nothing when we get a job that doesn't match,
4+
# This allows us to accept extra arguments (by doing nothing when we get a job that doesn't match,
55
# rather than throwing an error).
6-
%:
7-
@:
6+
%:
7+
@:
88

99
# $(MAKECMDGOALS) is the list of "targets" spelled out on the command line
10-
stagel:
10+
stagel:
1111
git clone --quiet https://github.com/mongodb/snooty-scripts.git build_scripts
1212
@ cd build_scripts && npm list mongodb || npm install mongodb
1313
@ source ~/.config/.snootyenv && node build_scripts/app.js $(filter-out $@,$(MAKECMDGOALS))
@@ -25,7 +25,7 @@ repo:
2525
world:
2626
@:
2727

28-
clean:
28+
clean:
2929
rm -rf build
3030

3131
.PHONY: stage

source/code-snippets/connection/srv.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { MongoClient } = require("mongodb");
22

33
// Connection URI
44
const uri =
5-
"mongodb+srv://sample-hostname:27017/?poolSize=20&useUnifiedTopology=true";
5+
"mongodb+srv://sample-hostname:27017/?poolSize=20&w=majority";
66

77
// Create a new MongoClient
88
const client = new MongoClient(uri);

source/code-snippets/crud/arrayFilters.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const stream = require("stream");
44

55
// Replace the following string with your MongoDB deployment's connection string.
66
const uri =
7-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
7+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
88
const client = new MongoClient(uri);
99

1010
async function run() {

source/code-snippets/crud/cursor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const stream = require("stream");
44

55
// Replace the following string with your MongoDB deployment's connection string.
66
const uri =
7-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
7+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
88
const client = new MongoClient(uri);
99

1010
async function forEachIteration(collection) {

source/code-snippets/crud/pizza.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the following string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77
const client = new MongoClient(uri);
88

99
function sleep(ms) {

source/code-snippets/crud/startrek.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the following string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77
const client = new MongoClient(uri);
88

99
async function word(movies) {

source/code-snippets/crud/theaters.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the following string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77
const client = new MongoClient(uri);
88

99
async function proximity(theaters) {

source/code-snippets/indexes/compound.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ const { MongoClient } = require("mongodb");
33
// Replace the following with your MongoDB deployment's connection
44
// string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

8-
const client = new MongoClient(uri, {
9-
useNewUrlParser: true,
10-
useUnifiedTopology: true,
11-
});
8+
const client = new MongoClient(uri);
129

1310
async function run() {
1411
try {

source/code-snippets/indexes/geo.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ const { MongoClient } = require("mongodb");
33
// Replace the following with your MongoDB deployment's connection
44
// string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

8-
const client = new MongoClient(uri, {
9-
useNewUrlParser: true,
10-
useUnifiedTopology: true,
11-
});
8+
const client = new MongoClient(uri);
129

1310
async function run() {
1411
try {

source/code-snippets/indexes/multikey.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ const { MongoClient } = require("mongodb");
33
// Replace the following with your MongoDB deployment's connection
44
// string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

8-
const client = new MongoClient(uri, {
9-
useNewUrlParser: true,
10-
useUnifiedTopology: true,
11-
});
8+
const client = new MongoClient(uri);
129

1310
async function run() {
1411
try {

source/code-snippets/indexes/single-field.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ const { MongoClient } = require("mongodb");
33
// Replace the following with your MongoDB deployment's connection
44
// string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

8-
const client = new MongoClient(uri, {
9-
useNewUrlParser: true,
10-
useUnifiedTopology: true,
11-
});
8+
const client = new MongoClient(uri);
129

1310
async function run() {
1411
try {

source/code-snippets/indexes/text.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ const { MongoClient } = require("mongodb");
33
// Replace the following with your MongoDB deployment's connection
44
// string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

8-
const client = new MongoClient(uri, {
9-
useNewUrlParser: true,
10-
useUnifiedTopology: true,
11-
});
8+
const client = new MongoClient(uri);
129

1310
async function run() {
1411
try {

source/code-snippets/indexes/unique.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ const { MongoClient } = require("mongodb");
33
// Replace the following with your MongoDB deployment's connection
44
// string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

8-
const client = new MongoClient(uri, {
9-
useNewUrlParser: true,
10-
useUnifiedTopology: true,
11-
});
8+
const client = new MongoClient(uri);
129

1310
async function run() {
1411
try {

source/code-snippets/logging/levels.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { MongoClient, Logger } = require("mongodb");
44
// Replace the following with your MongoDB deployment's connection
55
// string.
66
const uri =
7-
"mongodb+srv://<clusterUrl>/?replicaSet=rs&retryWrites=true&w=majority";
7+
"mongodb+srv://<clusterUrl>/?replicaSet=rs&w=majority";
88

99
const client = new MongoClient(uri);
1010

source/code-snippets/monitoring/subscribe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { MongoClient } = require("mongodb");
44
// Replace the following with your MongoDB deployment's connection
55
// string.
66
const uri =
7-
"mongodb+srv://<clusterUrl>/?replicaSet=rs&retryWrites=true&w=majority";
7+
"mongodb+srv://<clusterUrl>/?replicaSet=rs&w=majority";
88

99
const client = new MongoClient(uri);
1010

source/code-snippets/usage-examples/bulkWrite-example.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const fs = require("fs");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/changeStream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/command.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/count.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/deleteMany.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/deleteOne.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/distinct.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/find.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/findOne.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/insertMany.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/insertOne.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/replaceOne.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/updateMany.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/code-snippets/usage-examples/updateOne.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { MongoClient } = require("mongodb");
33

44
// Replace the uri string with your MongoDB deployment's connection string.
55
const uri =
6-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
6+
"mongodb+srv://<user>:<password>@<cluster-url>?w=majority";
77

88
const client = new MongoClient(uri);
99

source/fundamentals/connection.txt

+1-8
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ your MongoDB instance.
4444

4545
The last part of the connection string contains connection and authentication
4646
options as parameters. In the example above, we set two connection options:
47-
``poolSize=20`` and ``useUnifiedTopology=true``.
47+
``poolSize=20`` and ``w=majority``.
4848

4949
The code below shows how you can use the sample connection URI in a client to
5050
connect to MongoDB.
@@ -91,13 +91,6 @@ URI to specify the behavior of the client.
9191
- Default Value
9292
- Description
9393

94-
* - **useUnifiedTopology**
95-
- boolean
96-
- ``false``
97-
- Specifies whether to opt into the new Server Discovery and Monitoring
98-
(SDAM) engine. The next major driver release removes the old engine and
99-
deprecates this option.
100-
10194
* - **validateOptions**
10295
- boolean
10396
- ``false``

source/quick-start.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ that has **atlasAdmin** permissions.
147147

148148
// Replace the uri string with your MongoDB deployment's connection string.
149149
const uri =
150-
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true";
150+
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority";
151151

152152
const client = new MongoClient(uri);
153153

0 commit comments

Comments
 (0)