 <blockquote> <p>1. Can we get all field names of a collection with their data types?</p> </blockquote> <p>mongodb collections are schema-less, which means each <code>document</code> (row in relation database) can have different fields. When you find a <code>document</code> from a <code>collection</code>, you could get its fields names and data types.</p> <blockquote> <p>2. Can we generate a random value of that data type in mongo shell?</p> <p>3. how to set the values dynamically to store random data.</p> </blockquote> <p>mongo shell use JavaScript, you may write a js script and run it with <code>mongo the_js_file.js</code>. So you could generate a random value in the js script.</p> <p>It's useful to have a look at the <a href="http://api.mongodb.org/js" rel="nofollow">mongo JavaScript API documentation</a> and the mongo shell <a href="http://docs.mongodb.org/manual/reference/method/" rel="nofollow">JavaScript Method Reference</a>.</p> <p>Other script language such as Python can also do that. mongodb has their APIs too.</p>