Merge pull request #29863 from NormanPerrin/master

mongoose: change useCreateIndex position in connect option obj
This commit is contained in:
Daniel Rosenwasser
2018-11-01 17:15:42 -07:00
committed by GitHub
2 changed files with 5 additions and 7 deletions
+4 -6
View File
@@ -1,4 +1,4 @@
// Type definitions for Mongoose 5.2.13
// Type definitions for Mongoose 5.3.4
// Project: http://mongoosejs.com/
// Definitions by: horiuchi <https://github.com/horiuchi>
// sindrenm <https://github.com/sindrenm>
@@ -13,6 +13,7 @@
// Idan Dardikman <https://github.com/idandrd>
// Dominik Heigl <https://github.com/various89>
// Fazendaaa <https://github.com/Fazendaaa>
// Norman Perrin <https://github.com/NormanPerrin>
// Dan Manastireanu <https://github.com/danmana>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -391,6 +392,8 @@ declare module "mongoose" {
useNewUrlParser?: boolean;
/** Set to false to make findOneAndUpdate() and findOneAndRemove() use native findOneAndUpdate() rather than findAndModify(). */
useFindAndModify?: boolean;
/** If true, this connection will use createIndex() instead of ensureIndex() for automatic index builds via Model.init(). */
useCreateIndex?: boolean;
// TODO
safe?: any;
@@ -409,11 +412,6 @@ declare module "mongoose" {
* models associated with this connection.
*/
autoIndex?: boolean;
/**
* If true, this connection will use createIndex() instead of ensureIndex() for automatic index builds via Model.init().
*/
useCreateIndex?: boolean;
};
}
+1 -1
View File
@@ -22,12 +22,12 @@ const connection2: Promise<mongoose.Mongoose> = mongoose.connect(connectUri, {
pass: 'housan',
config: {
autoIndex: true,
useCreateIndex: true,
},
mongos: true,
bufferCommands: false,
useNewUrlParser: true,
useFindAndModify: true,
useCreateIndex: true
});
const connection3: null = mongoose.connect(connectUri, function (error) {
error.stack;