title: How to group by documents by week in mongodb
body: <pre><code>{
       "_id" : ObjectId("568b650543712795bf864a45"),
      "companyId" : "55e2d7cfdc8f74d14f5c900f",
      "timeStamp" : ISODate("2014-12-03T18:30:00.000Z")
  },
  {
      "_id" : ObjectId("568b650543712795bf864a49"),
  
      "companyId" : "55e2d7cfdc8f74d14f5c900f",
      "timeStamp" : ISODate("2014-12-04T18:30:00.000Z")
  }
  </code></pre>
  
  <p>how to group by documents by week in mongodb. i need to get document grouped by last 7 weeks and week grouping should be on the basis of "timeStamp" field in the document. </p>