Skip to content

Commit

Permalink
projection not filter
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed May 3, 2024
1 parent d70bb6b commit 71dc36e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions service/database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 71dc36e

Please sign in to comment.