Run Prettier
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
10034ddf2a
commit
1805040f93
@ -14,9 +14,7 @@ const db = client.db(dbName);
|
||||
|
||||
async function query(collection, query, returnId = false) {
|
||||
await client.connect();
|
||||
logger.trace(
|
||||
`dbAccess.query: Connecting to collection: '${collection}'`
|
||||
);
|
||||
logger.trace(`dbAccess.query: Connecting to collection: '${collection}'`);
|
||||
var qcoll = db.collection(collection);
|
||||
var qcursor = qcoll.find(query);
|
||||
if (!returnId) {
|
||||
@ -34,7 +32,10 @@ async function queryProject(collection, query, projection) {
|
||||
logger.debug(`dbAccess.queryProject: Connecting to col: '${collection}'`);
|
||||
const qcoll = db.collection(collection);
|
||||
const qcursor = qcoll.find(query).project(projection);
|
||||
logger.debug(projection, `dbAccess.query: Running Query: ${JSON.stringify(query)}`)
|
||||
logger.debug(
|
||||
projection,
|
||||
`dbAccess.query: Running Query: ${JSON.stringify(query)}`
|
||||
);
|
||||
increment(collection);
|
||||
return await qcursor.toArray();
|
||||
}
|
||||
@ -48,9 +49,7 @@ async function queryAggregate(collection, pipeline) {
|
||||
}
|
||||
|
||||
async function increment(target) {
|
||||
logger.debug(
|
||||
`dbAccess.increment: Incrementing counter for: ${target}`
|
||||
);
|
||||
logger.debug(`dbAccess.increment: Incrementing counter for: ${target}`);
|
||||
await client.connect();
|
||||
let col = db.collection("meta");
|
||||
let update = {};
|
||||
@ -102,7 +101,9 @@ async function delRegReq(uuid) {
|
||||
}
|
||||
|
||||
async function colCount(collection) {
|
||||
logger.debug(`dbAccess.colCount: Counting entries in collection: ${collection}`);
|
||||
logger.debug(
|
||||
`dbAccess.colCount: Counting entries in collection: ${collection}`
|
||||
);
|
||||
await client.connect();
|
||||
let col = db.collection(collection);
|
||||
let count = col.countDocuments();
|
||||
|
Loading…
Reference in New Issue
Block a user