title: How are document-based datastores (e.g., Mongo) implemented vs a key-value store?
body: <p>I've been reading a bit lately on document-based databases vs. key-value stores (Here's a good overview <a href="https://stackoverflow.com/questions/3554169/difference-between-document-based-and-key-value-based-databases">Difference between Document-based and Key/Value-based databases?</a>
  )  and I'm having trouble finding good info on the following.   </p>
  
  <p>If we query either of these with the
      key (or an additional index), there's no real difference in the mechanics - get the value.  I'm
      not clear on how a document store is
      that different from a key-value
      store when querying non-indexed
      documents/fields.  If I were to implement a
      document store on top of a key-value
      store, I'd do a 'table scan' (check
      all key/value pairs) for the
      appropriate value in the query - do
      document stores do more than this under the covers?  Is it appropriate to think of document data stores in this fashion?  </p>
  
  <p>This is less of a practical question (would I use Mongo over a BDB if I needed to do something useful, most likely) than one aimed at understanding the underlying technology.  I'm interested in the scaling aspects of particular systems only if they are applicable to the underlying implementation.</p>