I have a simple collection and a simple query. I got that it takes very long time like 45-60 seconds. I tried to understand what is going on.
When the query is like findOne({usernames:'someuser'})
that takes 4-5 seconds. But only find()
takes 45 seconds. I imported the same data into the local mongodb server and it doesnt even take 1 second. (Nodejs Express server + Mongoose also I tried same for Mongo NAtive dirver)
I check logs on remote server but there is nothing specific and nothing shows any log that implies query could be some slow. Mongo server runs on docker, version is 4.4. and I upgraded to 5 and still nothing changed.
I checked memory and cpu usages, cpu is not even 1%, and mem usage is not even 20%. It is not a busy server, no specific big data.
I open mongo shell and the result comes in 7-8 seconds.
So what is happening? What should I do to understand what is going on? setLogLevel(5) many logs but nothing like error