summaryrefslogtreecommitdiff
path: root/jstests/core/bulk_insert.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/bulk_insert.js')
-rw-r--r--jstests/core/bulk_insert.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/jstests/core/bulk_insert.js b/jstests/core/bulk_insert.js
new file mode 100644
index 00000000000..e2e625e0a3c
--- /dev/null
+++ b/jstests/core/bulk_insert.js
@@ -0,0 +1,24 @@
+// Tests bulk insert of docs from the shell
+
+var coll = db.bulkInsertTest
+coll.drop()
+
+var seed = new Date().getTime();
+Random.srand( seed );
+print("Seed for randomized test is " + seed);
+
+var bulkSize = Math.floor( Random.rand() * 200 ) + 1
+var numInserts = Math.floor( Random.rand() * 300 ) + 1
+
+print( "Inserting " + numInserts + " bulks of " + bulkSize + " documents." )
+
+for( var i = 0; i < numInserts; i++ ){
+ var bulk = []
+ for( var j = 0; j < bulkSize; j++ ){
+ bulk.push({ hi : "there", i : i, j : j })
+ }
+
+ coll.insert( bulk )
+}
+
+assert.eq( coll.count(), bulkSize * numInserts )