chilts / mongodb-queue

Message queues which uses MongoDB.
209 stars 92 forks source link

Fail gracefully when adding an empty array #18

Closed aidenkeating closed 7 years ago

aidenkeating commented 7 years ago

Currently when adding an empty array using queue.add an error will be thrown by MongoDB clients (at least in version 2.x.x), this performs a check on the payload of add.

If it's an array with a length of 0 an error with a more descriptive message will be returned instead of MongoError: Invalid Operation, No operations in bulk being thrown.

aidenkeating commented 7 years ago

Hi @chilts,

Would you mind taking a look?

chilts commented 7 years ago

Released as v3.1.0. Many thanks and sorry for the delay! :)