Closed waheedmoeed closed 3 years ago
Hello @waheedmoeed !
Yes, this is quite normal, the "list" function expects a callback, look the doc: https://github.com/darkterra/mongo-scheduler#schedulerlist.
However if you absolutely want to use Async / Await, you can wrap the "list" method with a function that returns a promise.
Ex:
async function getSchedulerList(options) {
return new Promise((resolve, reject) => {
scheduler.list(options, (err, events) => {
if (err) {
reject(err);
}
else {
resolve(events);
}
});
});
};
Do not hesitate if you have other questions :)
If you have no other questions, I close this issue. Do not hesitate to let me know if the explanation is sufficiently clear and if the solution I am proposing suits you.
Hello @waheedmoeed, I made a new update of the module. Now you can direct call function list with Async / Await call.
For more info, check this version: https://github.com/darkterra/mongo-scheduler/tree/v2.3.0
scheduler.list() method not returning any error or result. let response = await scheduler.list()