title: Querying nested array in cosmos db
body: <p>Having list of documents as below mentioned.</p>
  <p><strong>Document1:</strong></p>
  <pre><code> {
      id:1,
      PostList:[
       {
           postname:&quot;aaa&quot;,
           lastdatetime:2017-07-13T17:10:25+05:30,
           sname:&quot;sas&quot;
       },
       {
           postname:&quot;aaa1&quot;,
           lastdatetime:2017-07-14T17:10:25+05:30,
           sname:&quot;sasadd&quot;
       },
       {
           postname:&quot;aaa2&quot;,
           lastdatetime:2017-07-10T17:10:25+05:30,
           sname:&quot;weq&quot;
       }
       ]
  }
  </code></pre>
  <p><strong>Document2:</strong></p>
  <pre><code> {
          id:2,
          PostList:[
           {
               postname:&quot;aaa&quot;,
               lastdatetime:2017-07-13T17:10:25+05:30,
               sname:&quot;sas&quot;
           },
           {
               postname:&quot;aaa1&quot;,
               lastdatetime:2017-07-14T17:10:25+05:30,
               sname:&quot;sasadd&quot;
           },
           {
               postname:&quot;aaa2&quot;,
               lastdatetime:2017-07-10T17:10:25+05:30,
               sname:&quot;weq&quot;
           }
           ]
  }
  </code></pre>
  <p>I need a list of postnames which is equal to &quot;aaa&quot; with orderby lastdatetime.</p>
  <p>I am able to get query</p>
  <pre><code>select f.lastdatetime,f.postname
  from c 
  join f in c.PostList 
  where f.postname='aaa' 
  </code></pre>
  <p>But I need to get the list with orderby lastdatetime.</p>
  <p>When I try the below query, I am getting an error</p>
  <blockquote>
  <p>Order-by over correlated collections is not supported</p>
  </blockquote>
  <pre><code>select f.lastdatetime,f.postname
  from c 
  join f in c.PostList 
  where f.postname='aaa' ORDER BY f.lastdatetime ASC
  </code></pre>
  <p>Does anybody have an idea to get through?</p>