title: Query data stored in MongoDB by date & time
body: <p>I want to count the number of objects which were stored in the MongoDB after a certain time. Date is stored in MongoDB in following format.</p>
  
  <pre><code> "clickTime" : ISODate("2016-07-09T07:17:29.932Z")
  </code></pre>
  
  <p>I wrote the following code to count the objects but it is giving me <code>_count = 0</code>, while it should give me <code>_count = 1</code>. I am doing this in Django</p>
  
  <pre><code>def Count(request):
      time_from = datetime.time(0, 0, 0)
  
      ## today's count
      d1 = datetime.date.today()
      start1 = datetime.datetime.combine(d1,time_from)
      end1 = datetime.datetime.now()
      count1 = utils.Processor1(collect,start1,end1)
  </code></pre>
  
  <p>this is my utils file</p>
  
  <pre><code> def Processor1(collect,start,end):
     _count = collect.find({"clickTime":{"$gte":start,"$lte":end}}).count()
     return _count
  </code></pre>