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
@@ -1,4 +1,6 @@
1
1
  # 版本更新日志
2
+ ## v13.2.2
3
+ - Fix MongoDB connection initialization logic
2
4
  ## v13.2.1
3
5
  - Fix MongoManager to use correct connection for stats
4
6
  ## v13.2.0
@@ -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 = await mongoose_2.default.createConnection("mongodb://" + this._mongocfg.host + ":" + this._mongocfg.port, this._mongocfg.options);
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
- console.log("mongo connect success! db=" + this._connection.db.databaseName);
144
+ await this._connection.asPromise();
145
+ console.log("mongo connect success! db=" + this._connection.name);
145
146
  return true;
146
147
  }
147
148
  onConnect() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "13.2.1",
3
+ "version": "13.2.2",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",