What you’re doing is querying only with {$lte: toDate}
losing $gte
operator in the key overwrite. What you want is:
query.put("dateAdded", BasicDBObjectBuilder.start("$gte", fromDate).add("$lte", toDate).get());
What you’re doing is querying only with {$lte: toDate}
losing $gte
operator in the key overwrite. What you want is:
query.put("dateAdded", BasicDBObjectBuilder.start("$gte", fromDate).add("$lte", toDate).get());