title: DocumentDB - WHERE clause within collection
body: <p>Given a sample document like this one from the Microsoft examples:</p>
  
  <pre><code>{
    "id": "AndersenFamily",
    "lastName": "Andersen",
    "parents": [
       { "firstName": "Thomas" },
       { "firstName": "Mary Kay"}
    ],
    "children": [
       {
           "firstName": "Henriette Thaulow", 
           "gender": "female", 
           "grade": 5,
           "pets": [{ "givenName": "Fluffy" }]
       }
    ],
    "address": { "state": "WA", "county": "King", "city": "seattle" },
    "creationDate": 1431620472,
    "isRegistered": true
  }
  </code></pre>
  
  <p>We can see that there is a sub-collection <code>children</code> containing an array of documents.</p>
  
  <p>Let's say I wanted to write a query using the <code>SELECT ... FROM ... WHERE ...</code> type syntax, how would I go about writing a query to find families with any daughters (any children with gender "female")</p>
  
  <p>So something like</p>
  
  <pre><code>SELECT c.id
  FROM c
  WHERE c.children.contains(  // I'm stuck!
  </code></pre>
  
  <p>I'm wondering if I'm missing a <code>JOIN</code> or something but honestly I'm not sure where I go from here, and I'm struggling to find anything helpful in Google partially because I'm not sure how to phrase my search!</p>