From 8a7cb9b0257b55884aff39f104cff8432cc032e9 Mon Sep 17 00:00:00 2001 From: chin Date: Sun, 24 Oct 2021 01:50:07 +0800 Subject: [PATCH] fix: incorrect countDocuments collection in `history` --- api/FHIRApiService/history.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/FHIRApiService/history.js b/api/FHIRApiService/history.js index 34cad790..5378616f 100644 --- a/api/FHIRApiService/history.js +++ b/api/FHIRApiService/history.js @@ -51,7 +51,7 @@ module.exports = async function(req, res, resourceType) { let operationOutcomeNotFound = handleError['not-found'](`id->"${id}" in resource "${resourceType}" not found`); return doRes(404, operationOutcomeNotFound); } - let count = await mongodb.Patient_history.countDocuments({ + let count = await mongodb[`${resourceType}_history`].countDocuments({ id: id }); let bundle = createBundle(req, docs, count, paginationSkip, paginationLimit, resourceType, {