From 71dc36e90690af564357e7adaa778519e68225c7 Mon Sep 17 00:00:00 2001 From: Birm Date: Fri, 3 May 2024 14:59:20 -0400 Subject: [PATCH] projection not filter --- service/database/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/database/index.js b/service/database/index.js index d628524..4290998 100644 --- a/service/database/index.js +++ b/service/database/index.js @@ -19,12 +19,12 @@ class Mongo { * * {@link https://docs.mongodb.com/manual/reference/method/db.collection.find/ Read MongoDB Reference} */ - static async find(database, collectionName, query, transform = true, filter = {}) { + static async find(database, collectionName, query, transform = true, projection = {}) { try { query = transformIdToObjectId(query); const collection = getConnection(database).collection(collectionName); - const data = await collection.find(query, filter).toArray(); + const data = await collection.find(query).project(projection).toArray(); /** allow caller method to toggle response transformation */ if (transform) {