Skip to content

Instantly share code, notes, and snippets.

@lyhcode
Created February 29, 2012 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyhcode/1939295 to your computer and use it in GitHub Desktop.
Save lyhcode/1939295 to your computer and use it in GitHub Desktop.
MongoDB 1m data insert test
db.foo.remove();
var rnd = function() {
return Math.floor(Math.random() * 1000 + 100).toString();
}
var date1 = new Date();
for (var i=0; i<1000000; i++) {
var row1 = {key: rnd(), value: 'data'+rnd()}
db.foo.save(row1);
}
print(new Date().getTime()-date1.getTime());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment