[mongoose] Add useUnifiedTopology to ConnectionOptions (#41329)

* Add useUnifiedTopology to ConnectionOptions

useUnifiedTopology is the flag for using the new Server Discovery and Monitoring engine instead of current (deprecated) one.

* Update the tests to include useUnifiedTopology
This commit is contained in:
newt
2020-01-02 15:13:29 -08:00
committed by Ryan Cavanaugh
parent 4a2ff32fde
commit 8af1edaa96
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -371,6 +371,8 @@ declare module "mongoose" {
useNewUrlParser?: boolean;
/** Set to false to make findOneAndUpdate() and findOneAndRemove() use native findOneAndUpdate() rather than findAndModify(). */
useFindAndModify?: boolean;
/** Flag for using new Server Discovery and Monitoring engine instead of current (deprecated) one */
useUnifiedTopology?: boolean;
// Legacy properties - passed to the connection server instance(s)
mongos?: any;
+1
View File
@@ -27,6 +27,7 @@ const connection2: Promise<mongoose.Mongoose> = mongoose.connect(connectUri, {
bufferCommands: false,
useNewUrlParser: true,
useFindAndModify: true,
useUnifiedTopology: true,
useCreateIndex: true,
autoIndex: true,
autoCreate: true,