title: Selecting values from objects in document nested array in CosmosDB
body: <p>Imagine we have a such collection (example taken from  <a href="https://www.documentdb.com/sql/demo" rel="noreferrer">https://www.documentdb.com/sql/demo</a>)</p>
  
  <pre><code>{
      "_id" : "19015",
      "description" : "Snacks, granola bars, hard, plain",
      "servings" : [ 
          {
              "amount" : 1,
              "description" : "bar",
              "weightInGrams" : 21
          }, 
          {
              "amount" : 1,
              "description" : "bar (1 oz)",
              "weightInGrams" : 28
          }, 
          {
              "amount" : 1,
              "description" : "bar",
              "weightInGrams" : 25
          }
      ]
  }
  </code></pre>
  
  <p>How i can query CosmosDB in SQL api to get results such like this?</p>
  
  <pre><code>{
      "_id" : "19015",
      "servings" : [ 
          {
              "description" : "bar"
          }, 
          {
              "description" : "bar (1 oz)"
          }, 
          {
              "description" : "bar"
          }
      ]
  }
  </code></pre>
  
  <p>at MongoDB i would use such query</p>
  
  <pre><code>db.getCollection('food').find({id: '19015'}, {'servings.description' : 1})
  </code></pre>
  
  <p>Tried multiple scenarious with joins etc</p>
  
  <pre><code>SELECT 
      food.id,
      food.servings.description
  FROM food
  WHERE food.id = "19015"
  </code></pre>
  
  <p>or </p>
  
  <pre><code>SELECT 
      food.id,
      [{
          description: food.servings[0].description
      }] AS servings
  FROM food
  WHERE food.id = "19015"
  </code></pre>
  
  <ul>
  <li>instead of <code>[0]</code> i tried <code>[]</code> or <code>[$]</code> but doesn't works</li>
  </ul>
  
  <p>Does somebody has idea how in simply way i can resolve this issue?</p>