From 1762c042d8ebbef3fd8a351799657d6329f7c3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20Tayyar=20BE=C5=9E=C4=B0K?= Date: Fri, 11 May 2018 10:12:12 +0200 Subject: [PATCH] open() is deprecated in mongoose >= 4.11.0 Breaking change in @Automattic/mongoose https://github.com/Automattic/mongoose/commit/dda165eebdb241397e9990440dc8e9c1f733db76#diff-259dec4414a400a6e895f16ff1d0ca3b --- types/mongoose/index.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 481b37c0a3..713448faec 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -190,6 +190,7 @@ declare module "mongoose" { /** * Opens the connection to MongoDB. + * @deprecated open() is deprecated in mongoose >= 4.11.0 * @param mongodb://uri or the host to which you are connecting * @param database database name * @param port database port @@ -200,6 +201,19 @@ declare module "mongoose" { */ open(connection_string: string, database?: string, port?: number, options?: ConnectionOpenOptions, callback?: (err: any) => void): any; + + /** + * Opens the connection to MongoDB. + * @param mongodb://uri or the host to which you are connecting + * @param database database name + * @param port database port + * @param options Mongoose forces the db option forceServerObjectId false and cannot be overridden. + * Mongoose defaults the server auto_reconnect options to true which can be overridden. + * See the node-mongodb-native driver instance for options that it understands. + * Options passed take precedence over options included in connection strings. + */ + openUri(connection_string: string, database?: string, port?: number, + options?: ConnectionOpenOptions, callback?: (err: any) => void): any; /** Helper for dropDatabase() */ dropDatabase(callback?: (err: any) => void): Promise;