[SERVER-12864] insert of array of documents fails in shell for array 1000+ and gives bad error message Created: 24/Feb/14  Updated: 05/May/14  Resolved: 12/Mar/14

Status: Closed
Project: Core Server
Component/s: Shell, Write Ops
Affects Version/s: 2.6.0-rc0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Asya Kamsky Assignee: Andreas Nilsson
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-12763 Shell insert method provides confusin... Closed
Operating System: ALL
Participants:

 Description   

write@local(2.6.0-rc0) > batch1.length
1000
write@local(2.6.0-rc0) > db.collection.insert(batch1)
2014-02-24T11:23:02.156-0800 Error: Cannot output SingleWriteResult from multiple batch result at src/mongo/shell/bulk_api.js:253
write@local(2.6.0-rc0) > batch1.length=999
999
write@local(2.6.0-rc0) > db.collection.insert(batch1)
WriteResult({ "nInserted" : 999 })

The issue is that in insert prototype it does:
result = batch.execute(wc).toSingleResult();
and a single batch is limited to 1000 documents (supposedly, it turns out to be 999 so maybe off by one here).



 Comments   
Comment by Andreas Nilsson [ 12/Mar/14 ]

This is is duplicate and should be fixed by commit 2ae43f11c9

Comment by Asya Kamsky [ 25/Feb/14 ]

That one seems to be for the message - the problem is that we now have a limit of 1000 documents to be sent in a batch (array) from the shell where that didn't use to be a limitation.

We should batch things into smaller batches behind the scenes OR document this as breaking behavior and make the user do it...

Generated at Thu Feb 08 03:29:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.