mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-04 19:42:46 +08:00
Add force close Connection#close variant
Connection#close can take a boolean argument `force`. This change goes back all the way to v4.11.14 (f9e0525fa2f7c8e254f3f949cab6273469b3df30).
This commit is contained in:
3
types/mongoose/index.d.ts
vendored
3
types/mongoose/index.d.ts
vendored
@@ -236,6 +236,9 @@ declare module "mongoose" {
|
||||
/** Closes the connection */
|
||||
close(callback?: (err: any) => void): Promise<void>;
|
||||
|
||||
/** Closes the connection */
|
||||
close(force?: boolean, callback?: (err: any) => void): Promise<void>;
|
||||
|
||||
/**
|
||||
* Retrieves a collection, creating it if not cached.
|
||||
* Not typically needed by applications. Just talk to your collection through your model.
|
||||
|
||||
@@ -135,7 +135,10 @@ conn1.openUri('mongodb://localhost/test', 'myDb', 27017, {
|
||||
autoIndex: false
|
||||
}
|
||||
}, function (err) {}).open('');
|
||||
conn1.close().catch(function (err) {});
|
||||
conn1.close().then(function () {}).catch(function (err) {});
|
||||
conn1.close(true).then(function () {}).catch(function (err) {});
|
||||
conn1.close(function (err) {});
|
||||
conn1.close(true, function (err) {});
|
||||
conn1.collection('name').$format(999);
|
||||
conn1.model('myModel', new mongoose.Schema({}), 'myCol').find();
|
||||
conn1.models.myModel.findOne().exec();
|
||||
|
||||
Reference in New Issue
Block a user