Server selection timed out after 30000 ms in mongodb code example

Example 1: 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

Example 2: 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

Tags:

Misc Example