newStaffLDB-API #48

Merged
fred.boniface merged 85 commits from newStaffLDB-API into main 2023-10-03 21:35:03 +01:00
Showing only changes of commit cf1b40f007 - Show all commits

View File

@ -16,16 +16,16 @@ const db = client.db(dbName);
async function query(collection, query, returnId = false) { async function query(collection, query, returnId = false) {
await client.connect(); await client.connect();
logger.logger.debug(`dbAccess.query: Connecting to collection: '${collection}'`) logger.logger.trace(`dbAccess.query: Connecting to collection: '${collection}'`)
var qcoll = db.collection(collection); var qcoll = db.collection(collection);
var qcursor = qcoll.find(query); var qcursor = qcoll.find(query);
if (!returnId) { if (!returnId) {
qcursor.project({ _id: 0 }); qcursor.project({ _id: 0 });
} }
logger.logger.debug(query, "dbAccess.query: Runnung Query") logger.logger.trace(query, "dbAccess.query: Runnung Query")
increment(collection); increment(collection);
let result = await qcursor.toArray(); let result = await qcursor.toArray();
logger.logger.debug(result, "dbAccess.query: Response"); logger.logger.trace(result, "dbAccess.query: Response");
return result; return result;
} }