chilts / mongodb-queue

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

Handle case where _id is nested using Mongoose #9

Closed carlosperez closed 7 years ago

carlosperez commented 8 years ago

When using Mongoose, we're finding that the results array item that contains _id is actually nested under the ops parameter. This patch checks for results.ops[0] first, otherwise defaulting to results[0].

chilts commented 8 years ago

Cool, thanks for this. I know nothing about Mongoose though. Are you able to just point me in the right direction for what Mongoose does with ops and why? I'll have a quick read and merge once I'm happy with this change. Cheers.

carlosperez commented 8 years ago

Hi @chilts – thanks for the quick response. Unfortunately, I'm not sure what Mongoose does with ops (or why). I searched the Mongoose repo for ops and there are some results that might help explain? https://github.com/Automattic/mongoose/search?utf8=%E2%9C%93&q=ops