title: How can I query MongoDB with date range using mgo and Go?
body: <p>Hi I have a collection named "my_sales" having fields product_name, price, sale_date.</p>
  
  <p>My doc looks like</p>
  
  <pre><code>{
      "_id" : ObjectId("5458b6ee09d76eb7326df3a4"),
      "product_name" : product1,
      "price" : 200,
      "sale_date" : ISODate("2014-11-04T11:22:19.589Z")
  }
  {
      "_id" : ObjectId("5458b6ee09d76eb7326df3a4"),
      "product_name" : product1,
      "price" : 200,
      "sale_date" : ISODate("2014-11-04T11:22:19.589Z")
  }
  {
      "_id" : ObjectId("5458b6ee09d76eb7326df3a4"),
      "product_name" : product1,
      "price" : 200,
      "sale_date" : ISODate("2014-11-04T11:22:19.589Z")
  }
  {
      "_id" : ObjectId("5458b6ee09d76eb7326df3a4"),
      "product_name" : product1,
      "price" : 200,
      "sale_date" : ISODate("2014-11-05T11:22:19.589Z")
  }
  </code></pre>
  
  <p>I tried in mongo shell like this</p>
  
  <pre><code> db.my_sales.find({ sale_date: { $gt: ISODate("2014-11-04"), $lt: new ISODate("2014-11-05") });
  </code></pre>
  
  <p>It giving the correct result. Now I need to query same thing using golang 
  I tried like this</p>
  
  <pre><code> var sales_his []Sale
   err := c.Find(bson.M{"sale_date":bson.M{ "$gt": "ISODate("+date_from+")", "$lt": "ISODate("+date_to+")" }    }).All(&amp;sales_his)
  </code></pre>
  
  <p>Its giving null result please help</p>