Monday, October 31, 2011

Generate data in mongo

I love mongodb!


This is the "hello world"" / simplest way I have found to generate sample data in mongod.

1. ensure "mongod" is running
2. open mongo shell (run "mongo")
3. for (i=0; i< 1000;i++){ db.mycoll.insert({"val":i}); }

And what you have is a collection with 1000 docs.

No comments:

Post a Comment