type-mongodb
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0-beta.2
@@ -18,2 +18,6 @@ import { MongoClient, MongoClientOptions, Db } from 'mongodb'; | ||
/** | ||
* Returns true if MongoClient is connected. | ||
*/ | ||
isConnected(): boolean; | ||
/** | ||
* Closes all the open connections. | ||
@@ -20,0 +24,0 @@ */ |
@@ -27,5 +27,4 @@ "use strict"; | ||
connect() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!((_a = this.client.topology) === null || _a === void 0 ? void 0 : _a.isConnected())) { | ||
if (!this.isConnected()) { | ||
yield this.client.connect(); | ||
@@ -36,8 +35,14 @@ } | ||
/** | ||
* Returns true if MongoClient is connected. | ||
*/ | ||
isConnected() { | ||
var _a; | ||
return !!((_a = this.client.topology) === null || _a === void 0 ? void 0 : _a.isConnected()); | ||
} | ||
/** | ||
* Closes all the open connections. | ||
*/ | ||
close(force) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if ((_a = this.client.topology) === null || _a === void 0 ? void 0 : _a.isConnected()) { | ||
if (this.isConnected()) { | ||
yield this.client.close(force); | ||
@@ -44,0 +49,0 @@ } |
@@ -73,2 +73,6 @@ import { MongoClient, Collection, Db, ClientSessionOptions } from 'mongodb'; | ||
/** | ||
* Returns true if client is connected | ||
*/ | ||
isConnected(): boolean; | ||
/** | ||
* Closes to all MongoClients. | ||
@@ -75,0 +79,0 @@ */ |
@@ -116,2 +116,8 @@ "use strict"; | ||
/** | ||
* Returns true if client is connected | ||
*/ | ||
isConnected() { | ||
return !!this.connection.isConnected(); | ||
} | ||
/** | ||
* Closes to all MongoClients. | ||
@@ -118,0 +124,0 @@ */ |
{ | ||
"name": "type-mongodb", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0-beta.2", | ||
"description": "A simple decorator based MongoDB ODM.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/j/type-mongodb", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
251554
3186