When I query through mongo shell or robo 3t the query takes about 3ms to 5ms. But the same query from my node(12.18.3) application which uses mongoose(5.5.10) it takes about 6000ms on average. Robo 3t returns 50 documents by default and mongo shell returns 20 I guess. Node application was returning 800 documents. So I made mongo shell return 800 documents by setting DBQuery.shellBatchSize = 300
. This query still took very less time than 6000ms.
What am I missing here ?
Edit 1: It's a Simple Query. db.gateways.find({org_id:1})
I have an index on org_id. Each Document has about 450 fields and average document size is 6.5kb. Above query returns 800 documents.