title: MongoDB - eval Vs. db.eval
body: <p>I have a simple stored script in system.js collection called getAllNotes.</p>
  
  <p>script code: <code>function (x) {  return db.notes.find(); }</code></p>
  
  <p>notes is a collection holding the data I wish to extract.</p>
  
  <p><code>eval('getAllNotes()')</code>  - works well and returns the data.</p>
  
  <p><code>db.eval('getAllNotes()')</code> - returns a JSON string with various configuration that has nothing to do 
  with my collection See below. Any idea? anyone understands the difference between executing eval and db.eval?</p>
  
  <pre><code> "_mongo" : {
                 "slaveOk" : false,
                 "host" : "EMBEDDED"
         },
         "_db" : {
                 "_mongo" : {
                         "slaveOk" : false,
                         "host" : "EMBEDDED"
                 },
                 "_name" : "test"
         },
         "_collection" : {
                 "_mongo" : {
                         "slaveOk" : false,
                         "host" : "EMBEDDED"
                 },
                 "_db" : {
                         "_mongo" : {
                                 "slaveOk" : false,
                                 "host" : "EMBEDDED"
                         },
                         "_name" : "test"
                 },
                 "_shortName" : "notes",
                 "_fullName" : "test.notes"
         },
         "_ns" : "test.notes",
         "_query" : {
  
         },
         "_fields" : null,
         "_limit" : 0,
         "_skip" : 0,
         "_batchSize" : 0,
         "_options" : 0,
         "_cursor" : null,
         "_numReturned" : 0,
         "_special" : false
  </code></pre>