-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.0.0
-
Component/s: Embedded Shell
-
None
-
Environment:Linux, sharded cluster on 4.2.12 Enterprise
-
Iteration Geneva, Iteration Hamburg, Iteration Ibadan, Iteration Johannesburg
-
Not Needed
Problem Statement/Rationale
Running a repro script that inserts a bunch of random documents into a sharded collection. It loops 10 times through an insertMany of 10000 documents.
After the first 10000 docs are written, it fails with the error:
TypeError: Cannot use 'in' operator to search for 'insertOne' in undefined
Same script works on legacy shell.
Steps to Reproduce
Here's the script. I suspect it doesn't need to be on a sharded collection but I haven't tried that.
tdbs = "test"; tcs = "foo"; tdbcs = tdbs + "." + tcs; tdb = db.getSiblingDB(tdbs); tc = tdb.getCollection(tcs); adb = db.getSiblingDB('admin'); cdb = db.getSiblingDB("config"); cc = cdb.getCollection("chunks"); tdb.dropDatabase(); sh.enableSharding(tdbs); tc.createIndex({a: 1}); sh.shardCollection(tdbcs, {a: 1}); function getRandom() { let r = ""; for (let i = 0; i < 100; i++) { r = r + Math.random().toString().substr(2); } return r; } niter = 10; nperiter = 10000; for (let k = 0; k < niter; k++) { let doc = []; let base = k * nperiter; for (let i = base; i < (base + nperiter); i++) { doc[i] = {a: i, b: getRandom()}; } tc.insertMany(doc); } // TypeError: Cannot use 'in' operator to search for 'insertOne' in undefined
Expected Results
Script should complete writing 10x10000 documents to the collection.
Actual Results
Script gets error mentioned above.
- split to
-
NODE-3565 Error for insertMany with partially empty array is unhelpful
- Closed