title: matching two string object fields in mongo aggregation
body: <pre><code>&gt; db.doc.find().pretty();
  {
      "_id" : ObjectId("55669401a5f628a23fed5adc"),
      "cur" : {
          "pathname" : "/blog",
          "href" : "http://www.example.com/blog/"
      },
      "visits" : [
          {
              "url" : "http://www.example.com/blog/",
              "gt_ms" : "1110"
          }
      ]
  }
  {
      "_id" : ObjectId("556697eba5f628a23fed5add"),
      "cur" : {
          "pathname" : "/twcontroller/insights/login.php",
          "href" : "http://www.example.com/twcontroller/insights/login.php"
      },
      "visits" : [
          {
              "url" : "http://www.example.com/twcontroller/insights/login.php",
              "gt_ms" : "990"
          }
      ]
  }
  {
      "_id" : ObjectId("556697eba5f628a23fed5ade"),
      "cur" : {
          "pathname" : "/",
          "href" : "http://www.example.com/"
      },
      "visits" : [
          {
              "url" : "http://www.example.com/",
              "gt_ms" : "719"
          },
          {
              "url" : "http://www.example.com/",
              "gt_ms" : "719"
          }
      ]
  }
  {
      "_id" : ObjectId("556697eba5f628a23fed5adf"),
      "cur" : {
          "pathname" : "/",
          "href" : "http://www.example.com/"
      },
      "visits" : [
          {
              "url" : "http://www.example.com/",
              "gt_ms" : "62"
          },
          {
              "url" : "http://www.example.com/",
              "gt_ms" : "62"
          },
          {
              "url" : "http://www.example.com/",
              "gt_ms" : "62"
          },
          {
              "url" : "http://www.example.com/",
              "gt_ms" : "62"
          },
          {
              "url" : "http://www.example.com/",
              "gt_ms" : "62"
          },
          {
              "url" : "http://www.example.com/",
              "gt_ms" : "62"
          },
          {
              "url" : "http://www.example.com/",
              "gt_ms" : "62"
          }
      ]
  }
  </code></pre>
  
  <p>I want to match the value of <code>cur.pathname</code> with the <code>visits[0].url</code> (<em>i.e., the first item in the array visits</em>) and returns its count. Also want to return the count of visits array which is having only one array element. </p>
  
  <p>How can I do this? </p>