title: how do i query for a mongo document using its collection attribute (acts_as_tree) using mongoid and mongo console?
body: <p>here's my model:</p>
  
  <pre><code>class Person
    acts_as_tree
  end
  </code></pre>
  
  <p>i relate multiple objects as a tree:</p>
  
  <pre><code>          P1
            |
           ---
          |   |
       P1.1   P1.2
         |
        ---
       |   |
  P1.1.1   P1.1.2
  </code></pre>
  
  <p>here if i need to retreive P1.1.1 i need to write a query that effectively asks: </p>
  
  <pre><code>get me the Person with name P1.1.1 and path (given by acts_as_tree) [P1, P1.1].
  </code></pre>
  
  <p>querying by just name is not enough as i can have similar named people at multiple paths.</p>
  
  <p>how do i do this?</p>
  
  <pre><code>&gt; db.people.find({name: 'P1.1.1'})
  </code></pre>
  
  <p>above snippet will show me the path attribute correctly as expected, but i cannot query by that path.</p>
  
  <pre><code>&gt; db.people.find({name: 'P1.1.1', path: [{name: 'P1'}, {name: 'P1.1'}]})
  </code></pre>
  
  <p>doesn't work. neither does:</p>
  
  <pre><code>&gt; db.people.find({name: 'P1.1.1', path: [db.people.find({name: 'P1'}), 
                                           db.people.find({name: 'P1.1'})]})
  </code></pre>
  
  <p>but that explains what i'm trying to do.</p>