[SERVER-12763] Shell insert method provides confusing error message when inserting many objects. Created: 18/Feb/14  Updated: 06/Jun/22  Resolved: 11/Mar/14

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.5.5
Fix Version/s: 2.6.0-rc2

Type: Bug Priority: Major - P3
Reporter: Andy Schwerin Assignee: Andreas Nilsson
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-12864 insert of array of documents fails in... Closed
is duplicated by SERVER-13154 shell doesn't correctly handle multi-... Closed
Related
related to SERVER-13172 Cryptic error when trying to update w... Closed
related to SERVER-66990 restore insert1.js test case Closed
related to SERVER-67042 reduce number of documents in bulk in... Closed
is related to SERVER-13119 Create JS test for inserting from an ... Closed
Operating System: ALL
Steps To Reproduce:

toInsert = [];
for (i = 0; i < 100 * 1000; ++i) { toInsert.push({_id: i, a: 1}) }
db.foo.insert(toInsert);

Expected result: A WriteResult object.
Actual:
Message is logged to console:

2014-02-18T11:00:51.406-0500 Cannot output SingleWriteResult from multiple batch result at src/mongo/shell/bulk_api.js:245

Participants:

 Description   

If you try to insert a large number of objects using the insert([]) method on a collection in the shell, you get back a confusing error message:

2014-02-18T11:00:51.406-0500 Cannot output SingleWriteResult from multiple batch result at src/mongo/shell/bulk_api.js:245



 Comments   
Comment by Githook User [ 11/Mar/14 ]

Author:

{u'username': u'agralius', u'name': u'Andreas Nilsson', u'email': u'andreas.nilsson@10gen.com'}

Message: SERVER-12763 Fixed write_result.js to use BulkWriteResult
Branch: master
https://github.com/mongodb/mongo/commit/868749b831b1867c2993e979ce044895ee3177cc

Comment by Githook User [ 11/Mar/14 ]

Author:

{u'username': u'agralius', u'name': u'Andreas Nilsson', u'email': u'andreas.nilsson@10gen.com'}

Message: SERVER-12763 Do not return a SingleWriteResult if inserting from array
Branch: master
https://github.com/mongodb/mongo/commit/2ae43f11c9b4484c9a5c05bc4fdc90cf85697952

Comment by Andreas Nilsson [ 10/Mar/14 ]

Ok cool, created and linked SERVER-13119

Comment by Scott Hernandez (Inactive) [ 10/Mar/14 ]

The support for arrays was added recently and most of the new code uses bulk/batch so I think we just have a test hole. We should def. add one to jstests/core

Comment by Andreas Nilsson [ 10/Mar/14 ]

How can we not have an automated test of inserting an array somewhere?

This issue should occur for shell write modes 'commands' and 'compatibility'.

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