-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
Description
node/src/API/WorkController.ts
Lines 59 to 70 in b07b875
| const getByFilters = async (worksFilters: WorksFilters = {}): Promise<WorksWithCount> => { | |
| workControllerLogger.trace({ method: 'getByFilters', worksFilters }, 'Getting Work by Filters from DB') | |
| const { offset, limit, ...filters } = worksFilters | |
| const works = await collection | |
| .find(filters, { projection: { _id: false } }) | |
| .sort({ _id: -1 }) | |
| .skip(offset) | |
| .limit(limit || 10) | |
| .toArray() | |
| const count = await collection.find(filters, { projection: { _id: false } }).count() | |
| return { count, works } | |
| } |
Update .find(filters, { projection: { _id: false } }) to something like
.find({ ...filters, id: { $exists: true } }, { projection: { _id: false } })