(appId, collectionName, query, select, sort, limit, skip, accessList, isMasterKey, opts)
| 22 | module.exports = { |
| 23 | |
| 24 | async find(appId, collectionName, query, select, sort, limit, skip, accessList, isMasterKey, opts) { |
| 25 | const deferred = q.defer(); |
| 26 | |
| 27 | try { |
| 28 | if ((opts && opts.ignoreSchema) || (collectionName === '_File')) { |
| 29 | const doc = await mongoService.document.find(appId, collectionName, query, select, sort, limit, skip, accessList, isMasterKey); |
| 30 | deferred.resolve(doc); |
| 31 | } else { |
| 32 | const _query = await _modifyFieldsInQuery(appId, collectionName, query); |
| 33 | const doc = await mongoService.document.find(appId, collectionName, _query, select, sort, limit, skip, accessList, isMasterKey); |
| 34 | deferred.resolve(doc); |
| 35 | } |
| 36 | } catch (err) { |
| 37 | winston.log('error', { |
| 38 | error: String(err), |
| 39 | stack: new Error().stack, |
| 40 | }); |
| 41 | deferred.reject(err); |
| 42 | } |
| 43 | |
| 44 | return deferred.promise; |
| 45 | }, |
| 46 | async count(appId, collectionName, query, limit, skip, accessList, isMasterKey) { |
| 47 | const deferred = q.defer(); |
| 48 |
nothing calls this directly
no test coverage detected