Skip to content

Commit 3230385

Browse files
committed
NODE-950 modified the index generation as suggested by Matt
1 parent 82f8055 commit 3230385

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/bulk/unordered.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,18 @@ var addToOperationsList = function(_self, docType, document) {
178178
}
179179

180180
// We have an array of documents
181-
var insertIndex;
182181
if(Array.isArray(document)) {
183182
throw toError("operation passed in cannot be an Array");
184183
} else {
185184
_self.s.currentBatch.operations.push(document);
186185
_self.s.currentBatch.originalIndexes.push(_self.s.currentIndex);
187-
insertIndex = _self.s.currentIndex;
188186
_self.s.currentIndex = _self.s.currentIndex + 1;
189187
}
190188

191189
// Save back the current Batch to the right type
192190
if(docType == common.INSERT) {
193191
_self.s.currentInsertBatch = _self.s.currentBatch;
194-
_self.s.bulkResult.insertedIds.push({index: insertIndex, _id: document._id});
192+
_self.s.bulkResult.insertedIds.push({index: _self.s.bulkResult.insertedIds.length, _id: document._id});
195193
} else if(docType == common.UPDATE) {
196194
_self.s.currentUpdateBatch = _self.s.currentBatch;
197195
} else if(docType == common.REMOVE) {

0 commit comments

Comments
 (0)