Skip to content

Commit

Permalink
docs: remove the useUnifiedTopology option from the MongoDB examples
Browse files Browse the repository at this point in the history
The `useUnifiedTopology` option is now deprecated and using it throws
an error with TypeScript.

Reference: https://www.mongodb.com/docs/drivers/node/current/whats-new/#what-s-new-in-4.0

> It is no longer required to specify `useUnifiedTopology` or `useNewUrlParser`.

Related: #417
  • Loading branch information
darrachequesne committed Oct 23, 2023
1 parent 62c0fb7 commit fc8edb7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 36 deletions.
12 changes: 3 additions & 9 deletions docs/categories/05-Adapters/adapter-mongo.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ const COLLECTION = "socket.io-adapter-events";

const io = new Server();

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down Expand Up @@ -89,9 +87,7 @@ const COLLECTION = "socket.io-adapter-events";

const io = new Server();

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down Expand Up @@ -170,9 +166,7 @@ npm install @socket.io/mongo-emitter mongodb
const { Emitter } = require("@socket.io/mongo-emitter");
const { MongoClient } = require("mongodb");

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ const COLLECTION = "socket.io-adapter-events";

const io = new Server();

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down Expand Up @@ -80,9 +78,7 @@ const COLLECTION = "socket.io-adapter-events";

const io = new Server();

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down Expand Up @@ -155,9 +151,7 @@ npm install @socket.io/mongo-emitter mongodb
const { Emitter } = require("@socket.io/mongo-emitter");
const { MongoClient } = require("mongodb");

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ const COLLECTION = "socket.io-adapter-events";

const io = new Server();

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down Expand Up @@ -80,9 +78,7 @@ const COLLECTION = "socket.io-adapter-events";

const io = new Server();

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down Expand Up @@ -155,9 +151,7 @@ npm install @socket.io/mongo-emitter mongodb
const { Emitter } = require("@socket.io/mongo-emitter");
const { MongoClient } = require("mongodb");

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ const COLLECTION = "socket.io-adapter-events";

const io = new Server();

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down Expand Up @@ -80,9 +78,7 @@ const COLLECTION = "socket.io-adapter-events";

const io = new Server();

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down Expand Up @@ -155,9 +151,7 @@ npm install @socket.io/mongo-emitter mongodb
const { Emitter } = require("@socket.io/mongo-emitter");
const { MongoClient } = require("mongodb");

const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0", {
useUnifiedTopology: true,
});
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");

const main = async () => {
await mongoClient.connect();
Expand Down

1 comment on commit fc8edb7

@vercel
Copy link

@vercel vercel bot commented on fc8edb7 Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.