diff --git a/mongodb-queue.ts b/mongodb-queue.ts index 79c0563..25ba41b 100644 --- a/mongodb-queue.ts +++ b/mongodb-queue.ts @@ -10,12 +10,7 @@ * **/ -import {randomBytes} from 'crypto'; -import {Collection, Db, Filter, FindOneAndUpdateOptions, Sort, UpdateFilter, WithId} from 'mongodb'; - -function id(): string { - return randomBytes(16).toString('hex'); -} +import {Collection, Db, Filter, FindOneAndUpdateOptions, ObjectId, Sort, UpdateFilter, WithId} from 'mongodb'; function now(): string { return (new Date()).toISOString(); @@ -135,7 +130,7 @@ export class MongoDBQueue { const update: UpdateFilter> = { $inc: {tries: 1}, $set: { - ack: id(), + ack: new ObjectId().toHexString(), visible: nowPlusSecs(visibility), }, }; diff --git a/package.json b/package.json index 28c1d30..bd254b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@reedsy/mongodb-queue", - "version": "7.0.1", + "version": "7.1.0", "description": "Message queues which uses MongoDB.", "main": "mongodb-queue.js", "scripts": {