Created
February 29, 2012 08:58
-
-
Save lyhcode/1939295 to your computer and use it in GitHub Desktop.
MongoDB 1m data insert test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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