Skip to content

Commit

Permalink
added new to ObjectId (agenda#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
PiRifle authored Apr 11, 2023
1 parent 308e7de commit a67a255
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/controllers/agendash.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = function (agenda, options) {

if (options.query && options.property) {
if (options.isObjectId) {
preMatch[options.property] = ObjectId(options.query);
preMatch[options.property] = new ObjectId(options.query);
} else if (/^\d+$/.test(options.query)) {
preMatch[options.property] = Number.parseInt(options.query, 10);
} else {
Expand Down Expand Up @@ -284,7 +284,7 @@ module.exports = function (agenda, options) {
const collection = agenda._collection.collection || agenda._collection;
const jobs = await collection
.find({
_id: { $in: jobIds.map((jobId) => ObjectId(jobId)) },
_id: { $in: jobIds.map((jobId) => new ObjectId(jobId)) },
})
.toArray();
if (jobs.length === 0) {
Expand All @@ -306,7 +306,7 @@ module.exports = function (agenda, options) {
}

return agenda.cancel({
_id: { $in: jobIds.map((jobId) => ObjectId(jobId)) },
_id: { $in: jobIds.map((jobId) => new ObjectId(jobId)) },
});
};

Expand Down

0 comments on commit a67a255

Please sign in to comment.