cgserver 13.2.1 → 13.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -135,13 +135,14 @@ class MongoExt {
|
|
|
135
135
|
this._inited = true;
|
|
136
136
|
Log_1.gLog.info("mongo config=" + JSON.stringify(this._mongocfg));
|
|
137
137
|
this._mongocfg.options.dbName = this._mongocfg.database;
|
|
138
|
-
this._connection =
|
|
138
|
+
this._connection = mongoose_2.default.createConnection("mongodb://" + this._mongocfg.host + ":" + this._mongocfg.port, this._mongocfg.options);
|
|
139
|
+
this._connection = this._connection.useDb(this._mongocfg.database);
|
|
139
140
|
this._connection.on("open", this.onOpen.bind(this));
|
|
140
141
|
this._connection.on("close", this.onClose.bind(this));
|
|
141
|
-
this._connection.useDb(this._mongocfg.database);
|
|
142
142
|
this._connection.on("connectionCreated", this.onConnect.bind(this));
|
|
143
143
|
this._connection.on("connectionClosed", this.onDisconnect.bind(this));
|
|
144
|
-
|
|
144
|
+
await this._connection.asPromise();
|
|
145
|
+
console.log("mongo connect success! db=" + this._connection.name);
|
|
145
146
|
return true;
|
|
146
147
|
}
|
|
147
148
|
onConnect() {
|