Skip to content

Instantly share code, notes, and snippets.

@kizzx2
Last active December 20, 2015 00:59
Show Gist options
  • Select an option

  • Save kizzx2/6045673 to your computer and use it in GitHub Desktop.

Select an option

Save kizzx2/6045673 to your computer and use it in GitHub Desktop.
var docs = [];
for(var i = 0; i < 20000; i++) {
docs.push({rnd: _rand(), t: "2013-06-23", N:7*i, A:1, V:0, n:"1234"});
}
docs.sort(function(a, b) {
return a.rnd - b.rnd;
});
var t0 = Date.now();
db.foos.insert(docs);
db.getLastError();
var t1 = Date.now();
print(db.foos.find().count() + " documents inserted");
print("Took " + (t1 - t0) + "ms");
MongoDB shell version: 2.4.5
connecting to: test
20000 documents inserted
Took 471ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment