@digipair/skill-mongodb 0.129.2 → 0.130.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.
package/dist/index.cjs.js CHANGED
@@ -65,6 +65,14 @@ let MongoDBService = class MongoDBService {
65
65
  await clientInstance.client.close();
66
66
  return value;
67
67
  }
68
+ async count(params, _pins, context) {
69
+ const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter } = params;
70
+ const clientInstance = await engine.executePinsList(client, context, `${context.__PATH__}.client`);
71
+ const instance = clientInstance.database.collection(collection);
72
+ const value = await instance.countDocuments(filter, options);
73
+ await clientInstance.client.close();
74
+ return value;
75
+ }
68
76
  };
69
77
  const database = (params, pins, context)=>new MongoDBService().database(params, pins, context);
70
78
  const find = (params, pins, context)=>new MongoDBService().find(params, pins, context);
@@ -73,7 +81,9 @@ const findById = (params, pins, context)=>new MongoDBService().findById(params,
73
81
  const insertOne = (params, pins, context)=>new MongoDBService().insertOne(params, pins, context);
74
82
  const updateOne = (params, pins, context)=>new MongoDBService().updateOne(params, pins, context);
75
83
  const updateById = (params, pins, context)=>new MongoDBService().updateById(params, pins, context);
84
+ const count = (params, pins, context)=>new MongoDBService().count(params, pins, context);
76
85
 
86
+ exports.count = count;
77
87
  exports.database = database;
78
88
  exports.find = find;
79
89
  exports.findById = findById;