Reputation: 5
I have configured RestHeart to get data from MongoDB. Most of the request work well and return the same results than if I use a client to query the MongoDB (RoboMongo, MongoDB Compass...). However some request like the following that involved filters with dates as strings take longer than with MongoDB clients and Nginx closes the connection after 60s (the same query with a client takes 0.163s)
## Request
https://IP/DB/Collection/?filter={'DATE_A':'2017-08-24'}
## Query
db.getCollection('collection').find({'DATE_A':'2017-08-24'})
The collection has an index for DATE_A attribute that is used when the query is executed with a client.
The configuration of RestHeart is the same as the default configuration in the documentation with the difference of the connection to MongoDB. In this case I use a cluster with 3 instances (1 Master and 2 slaves). Furthermore the RestHeart log file shows all the request that are executed except these requests so I can't see what happen with them.
Any suggestion in order to discover what and where is the issue with this queries? Thanks in advance.
Upvotes: 0
Views: 167
Reputation: 1253
Restheart also sort result by _id descending by default.
Try adding sort={'date':-1} or build a compound index
Upvotes: 1