Why is MongoDB slow?

There is a problem, came on a new project and here a simple query to get 1500 records from the database is 3.2 seconds(Sotho search without transfer). Can't find the cause. On old projects worked much faster. Tell me what could be the reason.
July 2nd 19 at 14:21
1 answer
July 2nd 19 at 14:23
Tag see mongoose. A couple of tips for working with it: try to play with the limit fields using find().select(/* object fields */). By default, mongoose returns the collection of your wrapper over the JS objects that are quite heavy. To POJO, you can use find().lean(). Not to wait until you return the entire collection of 1500 records you can use cursors with streams and work with data in batches.

But it's really hard to say what the problem is - iron is really not bad, but the problem is most likely in the IO loop, as is usually the case, depending on the number of nodes between the client, server, and database server. Maybe you have a proxy server stands in front and does not pull under load, maybe the server is overloaded with requests and you wait in line, can database a lot of connections and you're, again, waiting.
about lean() is not even aware of was helped. Thank you very much - anibal_Larkin commented on July 2nd 19 at 14:26

Find more questions by tags Node.jsMongooseMongoDB