good morning, afternoon or evening. I want to save the response time (from the time a request is sent, until it returns) in mongo db, I am not an expert on the subject, and I would like you to please shake my hand on this topic.
query: async (params = []) => {
const startTime = new Date().getTime();
let result = null;
let error = null;
try {
result = await mongoose.query(params);
const executionTime = (new Date().getTime() - startTime) / 1000;
logger.info(`${executionTime} s`);
} catch (err) {
error = err;
const executionTime = (new Date().getTime() - startTime) / 1000;
logger.info(`${executionTime} s`);
}
if (result !== null) { return result; }
throw error;
}
}; ```
this is what it returns:
```(node:48160) UnhandledPromiseRejectionWarning: TypeError: mongoose.query is not a function
previously working with postgres and where it says query placed pol, it was more intuitive. I would appreciate any help. thanks in advance.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/KWofAMV
Comments
Post a Comment