From d3583b4ef62de367f2463e144dfa7c630d14d600 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 22 Dec 2015 14:38:04 +0000 Subject: [PATCH] respect limit of 1000 ops in bulk operation with mongojs 1.x --- services/track-changes/app/coffee/PackManager.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/track-changes/app/coffee/PackManager.coffee b/services/track-changes/app/coffee/PackManager.coffee index 14b1522d86..082c1d8a9a 100644 --- a/services/track-changes/app/coffee/PackManager.coffee +++ b/services/track-changes/app/coffee/PackManager.coffee @@ -331,8 +331,8 @@ module.exports = PackManager = expect_nRemoved = packObj.pack.length logger.log {doc_id: doc_id}, "adding pack, removing #{expect_nRemoved} ops" bulk.insert packObj - packObj.pack.forEach (op) -> - bulk.find({_id:op._id}).removeOne() + ids = (op._id for op in packObj.pack) + bulk.find({_id:{$in:ids}}).remove() bulk.execute (err, result) -> if err? logger.error {doc_id: doc_id}, "error adding pack"