Skip to content

Instantly share code, notes, and snippets.

@gatesvp
Created April 14, 2011 04:54
Show Gist options
  • Select an option

  • Save gatesvp/918907 to your computer and use it in GitHub Desktop.

Select an option

Save gatesvp/918907 to your computer and use it in GitHub Desktop.
randomString = function(string_length) {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var randomstring = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
return randomstring;
}
cycle = function (x) {
db.createCollection("capped", {capped:true, size:x, max : 100000});
for (i = 0; i < (x / 200); i++) {
db.capped.insert({x:randomString(200)});
}
print(new Date);
printjson(db.capped.stats());
printjson(db.stats());
db.capped.drop();
}
cycle(10000000);
cycle(10000000);
cycle(10000000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment