The current documentation for the mongo-adapter on the Socket.io website https://socket.io/docs/v4/mongo-adapter/ has an outdated example that is not compatible with the recent versions of Mongoose.
However, the example in the Socket.io documentation still uses useUnifiedTopology: true which results in a TypeScript error:
"Argument of type '{ useUnifiedTopology: boolean; }' is not assignable to parameter of type 'MongoClientOptions'.
Object literal may only specify known properties, and 'useUnifiedTopology' does not exist in type 'MongoClientOptions'."
Steps to Reproduce:
Follow the example code provided in the documentation.
Expected Result:
The code should run without any errors and establish a connection with the MongoDB server.
Actual Result:
A TypeScript error is thrown as mentioned above.
Suggested Fix:
Update the documentation to remove the deprecated options. The corrected connection string would look like:
const mongoClient = new MongoClient("mongodb://localhost:27017/?replicaSet=rs0");
Thank you for looking into this. The outdated documentation could potentially lead to confusion for developers integrating the mongo-adapter into their projects.
Description:
The current documentation for the
mongo-adapter
on the Socket.io website https://socket.io/docs/v4/mongo-adapter/ has an outdated example that is not compatible with the recent versions of Mongoose.Based on the Mongoose migration guide from 5.x to 6.x https://mongoosejs.com/docs/6.x/docs/migrating_to_6.html#no-more-deprecation-warning-options, the options
useNewUrlParser
,useUnifiedTopology
,useFindAndModify
, anduseCreateIndex
are no longer supported.However, the example in the Socket.io documentation still uses
useUnifiedTopology: true
which results in a TypeScript error:Steps to Reproduce:
Expected Result: The code should run without any errors and establish a connection with the MongoDB server.
Actual Result: A TypeScript error is thrown as mentioned above.
Suggested Fix: Update the documentation to remove the deprecated options. The corrected connection string would look like:
Thank you for looking into this. The outdated documentation could potentially lead to confusion for developers integrating the
mongo-adapter
into their projects.