MCPcopy Create free account
hub / github.com/CloudBoost/cloudboost / count

Function count

api/tables/CloudObjects.js:79–110  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

77};
78
79const count = async (req, res) => { // get document(s) object based on query and various parameters
80 const { appId, tableName: collectionName } = req.params;
81 const {
82 query,
83 limit,
84 skip,
85 sdk = 'REST',
86 } = req.body;
87 const appKey = req.body.key || req.param('key');
88
89 apiTracker.log(appId, 'Object / Count', req.url, sdk);
90
91 try {
92 const isMasterKey = await appService.isMasterKey(appId, appKey);
93 const result = await customService.count(
94 appId,
95 collectionName,
96 query,
97 limit,
98 skip,
99 customHelper.getAccessList(req),
100 isMasterKey,
101 );
102 res.json(result);
103 } catch (error) {
104 winston.error({
105 error: String(error),
106 stack: new Error().stack,
107 });
108 res.status(400).send(error);
109 }
110};
111
112// get document(s) object based on query and various parameters
113const distinct = async (req, res) => {

Callers

nothing calls this directly

Calls 1

countMethod · 0.80

Tested by

no test coverage detected