diff --git a/types/connect-mongo/connect-mongo-tests.ts b/types/connect-mongo/connect-mongo-tests.ts index a512d7dc71..67caed7c27 100644 --- a/types/connect-mongo/connect-mongo-tests.ts +++ b/types/connect-mongo/connect-mongo-tests.ts @@ -43,3 +43,11 @@ app.use(session({ secret: 'secret', store: new MongoStore({db: mongoDb}) })); + +// NativeMongoPromiseOptions +var Client = mongodb.MongoClient; +var mongoDbPromise = Client.connect('mongodb://localhost/test'); +app.use(session({ + secret: 'secret', + store: new MongoStore({ dbPromise: mongoDbPromise}) +})); diff --git a/types/connect-mongo/index.d.ts b/types/connect-mongo/index.d.ts index 0b7443f7e1..6f71906fa5 100644 --- a/types/connect-mongo/index.d.ts +++ b/types/connect-mongo/index.d.ts @@ -91,14 +91,16 @@ declare namespace connectMongo { mongooseConnection: mongoose.Connection; } - export interface NaitiveMongoOptions extends DefaultOptions { + export interface NativeMongoOptions extends DefaultOptions { db: mongodb.Db; } + export interface NativeMongoPromiseOptions extends DefaultOptions { + dbPromise: Promise; + } + export interface MongoStoreFactory { - new (options: MongoUrlOptions): MongoStore; - new (options: MogooseConnectionOptions): MongoStore; - new (options: NaitiveMongoOptions): MongoStore; + new(options: MongoUrlOptions | MogooseConnectionOptions | NativeMongoOptions | NativeMongoPromiseOptions): MongoStore; } export class MongoStore extends session.Store {