title: How to get mongo command results in to a flat file
body: <p>How do I export the results of a MongoDB command to a flat file</p>
  
  <p>For example, If I am to get <code>db.collectionname.find()</code> into a flat file.</p>
  
  <p>I tried <code>db.collectionname.find() &gt;&gt; "test.txt"</code> doesnt seem to work.</p>