mongotimeouterror: server selection timed out after 30000 ms code example

Example 1: mongotimeouterror: server selection timed out after 30000 ms

This error happen if MongoDB server is not running or mongoDB URL is not proper. Is your mongoDB installed locally or it's on cloud? Also please check your connection of mongo using ROBO 3T or compass. -Thanks

Example 2: mongotimeouterror: server selection timed out after 30000 ms

just go to mongodb atlas admin panel.Go in security tab>Network Access> Then whitelist your IP by adding it

See this image to locate the particular menu

Note:Check your IP on google then add it

Tags:

Misc Example