title: Return actual type of a field in MongoDB
body: <p>In MongoDB, using <code>$type</code>, it is possible to filter a search based on if the field matches a BSON data type (see <a href="http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-ConditionalOperator%3A%7B%7B%24type%7D%7D" rel="noreferrer">DOCS</a>).</p>
  
  <p>For eg.</p>
  
  <pre><code>db.posts.find({date2: {$type: 9}}, {date2: 1})
  </code></pre>
  
  <p>which returns:</p>
  
  <pre><code>{ 
      "_id" : ObjectId("4c0ec11e8fd2e65c0b010000"), 
      "date2" : "Fri Jul 09 2010 08:25:26 GMT" 
  }
  </code></pre>
  
  <p>I need a query that will tell me what the actual type of the field is, for every field in a collection. Is this possible with MongoDB?</p>