title: Find in referenced/linked MongoDB document, using pymongo
body: <p>I have 3 linked documents like:</p>
  
  <pre><code>{'_id':1, 'name':'abc', 'label':'actionA', 'prev':null}
  {'_id':2, 'name':'pqr', 'label':'actionB', 'prev':ObjectId('1')}
  {'_id':3, 'name':'xyz', 'label':'actionC', 'prev':ObjectId('2')}
  </code></pre>
  
  <p>Now I want to query a document whose 'name' is 'pqr' and also its previous/linked document should contains 'label' as 'actionA'.
  All I want is it should find 'name' and check whether previous liked doc is available, if so then check its previous doc should have 'label' which I want.
  It will be preferable if using some 1 line command something like:</p>
  
  <pre><code>db.collection.find({'$and'[{'name':'pqr'},{'prev': &lt;gotoprev&gt;({'label':'actionA'})}]})
  </code></pre>