cgserver 10.0.19 → 10.0.20

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,3 +1,5 @@
1
+ 10.0.20
2
+ 1、增加bulkwrite接口
1
3
  10.0.9
2
4
  1、修复mongoservicemanager的接口bug
3
5
  10.0.8
@@ -133,5 +133,9 @@ class MongoBaseService {
133
133
  let rs = await this.mongoDb.distinct(this._table, key, where);
134
134
  return rs;
135
135
  }
136
+ async bulkWrite(operations, options) {
137
+ let bwr = await this.mongoDb.bulkWrite(this._table, operations, options);
138
+ return bwr;
139
+ }
136
140
  }
137
141
  exports.MongoBaseService = MongoBaseService;
@@ -534,6 +534,14 @@ class MongoExt {
534
534
  }
535
535
  return false;
536
536
  }
537
+ async bulkWrite(collection, operations, options) {
538
+ if (!this._mongoDb) {
539
+ return;
540
+ }
541
+ let bulk = this._mongoDb.collection(collection);
542
+ let bwr = bulk.bulkWrite(operations, options);
543
+ return bwr;
544
+ }
537
545
  }
538
546
  exports.MongoExt = MongoExt;
539
547
  exports.gMongoMgr = new MongoManager();
@@ -112,4 +112,5 @@ export declare class MongoBaseService<T extends MongoBaseModel> {
112
112
  };
113
113
  lst: any;
114
114
  }>;
115
+ bulkWrite(operations: mongo.AnyBulkWriteOperation<mongo.BSON.Document>[], options?: mongo.BulkWriteOptions): Promise<mongo.BulkWriteResult>;
115
116
  }
@@ -199,5 +199,6 @@ export declare class MongoExt {
199
199
  * @param cb
200
200
  */
201
201
  quickTransaction(cb: Function, options?: mongo.TransactionOptions): Promise<false | any>;
202
+ bulkWrite(collection: string, operations: mongo.AnyBulkWriteOperation<mongo.BSON.Document>[], options?: mongo.BulkWriteOptions): Promise<mongo.BulkWriteResult>;
202
203
  }
203
204
  export declare let gMongoMgr: MongoManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "10.0.19",
3
+ "version": "10.0.20",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",