title: Multiple query in pymongo
body: <p>I have mongoDB with items of following structure:</p>
  
  <pre><code>{
      "some_field": {
          "date": 123,
          "text": "secondary text"
      },
      "text": "primary text"
  }
  </code></pre>
  
  <p>I want to write queries in pymongo that check for text field of top level and apply conditional query at the "date" field of second level. I'm getting filters of the form:</p>
  
  <pre><code>filter = {
      "text": "some target text",
      "date": {
          "start": some_int_val1,
          "end": some_int_val2
      }
  }
  </code></pre>
  
  <p>I can create query to "text" without any problem:</p>
  
  <pre><code>query = dict()
  query["text"] = filter["text"]
  </code></pre>
  
  <p>But I'm stucked about how to construct an <strong>$and</strong> query on <strong>"some_field.date"</strong>. I tried to simply combine them in one query:</p>
  
  <pre><code>query["somefield.date"] = [{"$gte": filter["common_date"]["start"]}, {"$lte": filter["common_date"]["end"]}]
  </code></pre>
  
  <p>But it didn't work. Also, I tried what I thought would work, but it throws an error:</p>
  
  <pre><code>query["somefield.date"] = { $and: [{"$gte": filter["date"]["start"]}, {: filter["date"]["end"]}]}
  </code></pre>
  
  <p>Saying "statement expected,  found Py:AND_KEYWORD". How can I overcome this?</p>