title: Inheritance in MongoDb: how to request instances of defined type
body: <p>This is how I used to utilize inheritance in Entity Framework (POCO):</p>
  
  <pre><code>ctx.Animals // base class instances (all instances)
  ctx.Animals.OfType&lt;Cat&gt;  // inherited class Cat's instances only
  ctx.Animals.OfType&lt;Dog&gt; // inherited class Dog's instances only
  </code></pre>
  
  <p>This is the only similar way I found in MongoDb (<a href="http://www.mongodb.org/display/DOCS/CSharp+Driver+Serialization+Tutorial" rel="nofollow">MongoDb reference</a>):</p>
  
  <pre><code>var query = Query.EQ("_t", "Cat");
  var cursor = collection.FindAs&lt;Animal&gt;(query);
  </code></pre>
  
  <p>Note in the latter case I have to deal with discriminator ("_t") and hardcode my class name, that is not quite convenient and looks awful. If I miss the query I got an exception on enumeration attempt. Have I missed something? My suggestion was the document Db which stores objects 'as is' should handle inheritance easily.</p>