I have a problem with a query type for MongoDB. In a data collection I have indexed almost all fields with {a: 1}, {b: 1} ... and queries like the following have a very good performance:
db.installations.find({deviceToken:"mydevicetoken"})
The following query with the indexed fields, takes much more so I deduce that I have not used the indexing correctly:
db.installations.find({ created_at: { $lte : ISODate("2016-12-24T06:44:59.999Z"),
$gte : ISODate("2016-12-23T21:45:00Z") } } ).sort( { created_at: 1 })
This last query throws me a lot of time in the mongotop to the point that it collapses the database due to excessive consultation time. Someone would know how to solve it. Thanks