mm_mongodb 1.5.5 → 1.5.6

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.
Files changed (2) hide show
  1. package/index.js +0 -15
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -157,7 +157,6 @@ MongoDB.prototype._ensureConnected = async function () {
157
157
  await this._ensureIndexes();
158
158
  }
159
159
 
160
- this.log('info', `成功连接到数据库,表名: ${this.table}`);
161
160
  } else {
162
161
  this.log('error', `[_ensureConnected] 连接失败,db对象为空或不具有collection方法`);
163
162
  throw new Error('数据库连接失败,db对象为空');
@@ -2915,9 +2914,6 @@ MongoDB.prototype.open = async function () {
2915
2914
  this.connected = false;
2916
2915
  });
2917
2916
 
2918
- this.log('info',
2919
- `成功连接到 ${this.config.host}:${this.config.port}/${this.config.database}`
2920
- );
2921
2917
  return true;
2922
2918
  } catch (error) {
2923
2919
  this.log('error', 'MongoDB连接失败:', error);
@@ -2932,7 +2928,6 @@ MongoDB.prototype.open = async function () {
2932
2928
  */
2933
2929
  MongoDB.prototype.close = async function () {
2934
2930
  if (this.conn) {
2935
- this.log('info', `关闭连接`);
2936
2931
  await this.conn.close().catch(err => this.log('error', '关闭MongoDB连接时出错:', err));
2937
2932
  this.conn = null;
2938
2933
  this.db = null;
@@ -2978,10 +2973,6 @@ MongoDB.prototype.createIndex = async function (keys, options = {}) {
2978
2973
  throw new Error('数据库未连接或未指定表名');
2979
2974
  }
2980
2975
 
2981
- this.log('info',
2982
- `创建索引: ${this.table}, keys: ${JSON.stringify(keys)}, options: ${JSON.stringify(options)}`
2983
- );
2984
-
2985
2976
  return await this.db.collection(this.table).createIndex(keys, options);
2986
2977
  } catch (error) {
2987
2978
  this.log('error', `创建索引失败: ${error.message}`);
@@ -3015,9 +3006,6 @@ MongoDB.prototype.createTTLIndex = async function (keys, expireAfterSeconds) {
3015
3006
  expireAfterSeconds: expireAfterSeconds
3016
3007
  };
3017
3008
 
3018
- this.log('info',
3019
- `创建TTL索引: ${this.table}, keys: ${JSON.stringify(keys)}, 过期时间: ${expireAfterSeconds}秒`);
3020
-
3021
3009
  return await this.db.collection(this.table).createIndex(keys, options);
3022
3010
  } catch (error) {
3023
3011
  this.log('error', `创建TTL索引失败: ${error.message}`);
@@ -3036,7 +3024,6 @@ MongoDB.prototype.getIndexes = async function () {
3036
3024
  throw new Error('未指定表名');
3037
3025
  }
3038
3026
 
3039
- this.log('info', `获取索引: ${this.table}`);
3040
3027
  return await this.db.collection(this.table).indexes();
3041
3028
  } catch (error) {
3042
3029
  this.log('error', `[getIndexes] 获取索引失败: ${error.message}`);
@@ -3058,7 +3045,6 @@ MongoDB.prototype.dropIndex = async function (indexName) {
3058
3045
  throw new TypeError('索引名称不能为空');
3059
3046
  }
3060
3047
  try {
3061
- this.log('info', `[dropIndex] 删除索引: ${this.table}, 索引名: ${indexName}`);
3062
3048
  await this.db.collection(this.table).dropIndex(indexName);
3063
3049
  return true;
3064
3050
  } catch (error) {
@@ -3077,7 +3063,6 @@ MongoDB.prototype.dropTable = async function () {
3077
3063
  throw new Error('未指定表名');
3078
3064
  }
3079
3065
  try {
3080
- this.log('info', `[dropTable] 删除集合: ${this.table}`);
3081
3066
  await this.db.collection(this.table).drop();
3082
3067
  return true;
3083
3068
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_mongodb",
3
- "version": "1.5.5",
3
+ "version": "1.5.6",
4
4
  "description": "MongoDB数据库操作模块,提供简洁易用的API、缓存功能以及完整的Redis兼容接口,支持事件系统、事务和连接池管理",
5
5
  "main": "index.js",
6
6
  "scripts": {