Error in finding the user MongooseError: Operation `users.findOne()` buffering timed out after 10000ms

i use cmd in terminal npm start and it start at port 5000 and also connect mongo db and when i brows localhost://5000 in browser, it open but when i sign up in it then in browser porcesssing only not any response.

and when i see in terminal it show me error :-1:

Express server is up and running on port 5000
Successfully connected to db cars
Error in finding the user MongooseError: Operation users.findOne() buffering timed out after 10000ms
at Timeout. (C:\Users\Irfan Ansari\Desktop\IssueTracker\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:175:23)
at listOnTimeout (node:internal/timers:564:17)
at process.processTimers (node:internal/timers:507:7)
Error in finding the user MongooseError: Operation users.findOne() buffering timed out after 10000ms
at Timeout. (C:\Users\Irfan Ansari\Desktop\IssueTracker\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:175:23)
at listOnTimeout (node:internal/timers:564:17)
at process.processTimers (node:internal/timers:507:7)

so pls solve it

C:\Users\Irfan Ansari>mongosh
Current Mongosh Log ID: 63cbdffba0f2600a491b9ec3
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.2
MongoServerSelectionError: Server selection timed out after 2000 ms

C:\Users\Irfan Ansari>

you can try this: Go to data services tab security on the left side and find network access inside that you choose to add the IP address and add 0.0.0.0/0 this IP address means you can access to database from any network address

2 Likes

MongooseError: Operation users.findOne() buffering timed out after 10000ms
at Timeout. (C:\Users\Hassan Dawood\Documents\commercehope-backend\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:
185:23)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)

@Hassan_Dawood have solved the issue please

I was encountering the same issue . So to solve this make sure your env (dotenv.config()) declarations are written to above the mongodb connection that you are doing .