title: Retrive data from mongo collection collection.find(query)
body: <p>I need to find users from collections whose creation time are in the range of fromTime and toTime. 
  user collection is</p>
  
  <pre><code>db.users.find().limit(1).pretty() {
      "_id": ObjectId("5c51a42efeb366379f27c679"),
      "devices": [{
              ...
              ...
              ...
          }
      ],
      "creationDate": NumberLong("1548854318313"),
      "isActive": true,
       ...
       ...
  }
  </code></pre>
  
  <p>If I use findOne without any query, it works</p>
  
  <pre><code>DBCollection collection = getDB().getCollection(“users”);
  System.out.println(“find One= " +    collection.findOne( ));
  </code></pre>
  
  <p>but when I am trying to add query then it is displaying no result.</p>
  
  <pre><code>DBCollection collection = getDB().getCollection(“users”);
  BasicDBObject query = new BasicDBObject(queryParams);
  query.put(“creationDate”, BasicDBObjectBuilder.start("$gte", fromTime).add("$lte", toTime).get());
  System.out.println(“collection.find(query));
  </code></pre>
  
  <p>where
  fromTime=1548854318310  and  toTime= 1548854318315</p>
  
  <p>It gives</p>
  
  <pre><code>DBCursor{collection=DBCollection{database=DB{name='appdb'}, name='users'},
  find=FindOptions{, batchSize=0, limit=0, modifiers=null, projection=null, maxTimeMS=0, skip=0,
   sort=null, cursorType=NonTailable, noCursorTimeout=false, oplogReplay=false, partial=false}}
  </code></pre>
  
  <p>what I am doing wrong?</p>