5

I just created a cluster in Mongodb Atlas and I can't connect to it either by my application or by the compass, the compass says: the certificate is not yet valid.

mongodb+srv://tbussola:@tindintest.fptqm.mongodb.net/test

In the application of moongose it points out: ould does not connect to any server in your MongoDB Atlas cluster. A common reason is that you are trying to access the database from an IP that is not whitelisted. Make sure that your current IP address is on the Atlas cluster IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/

mongodb+srv://tbussola:@tindintest.fptqm.mongodb.net/?retryWrites=true&w=majority

My ip is already listed in the whitelist and it is also enabled to allow any ip. What should I do now? I'm using Linux manjaro, I'm a beginner.

2
  • share whay are you typing cause it's impossible to guess. Just hide user and passwords like so: XXX. YYY etc Commented Nov 18, 2020 at 5:58
  • mongodb+srv://tbussola:<password>@tindintest.fptqm.mongodb.net/test Commented Nov 18, 2020 at 11:38

2 Answers 2

12

I was facing the same issue. After a lot of research I finally found this: certificate is not yet valid. The time on my pc was not my actual local time. After I sync my time from windows settings. Connection worked.

Sign up to request clarification or add additional context in comments.

1 Comment

That was the solution, even 3 years later! Thanks.
4

Using Windows 10:

Step 1: Go to date time setting.

Step 2: Go to additional setting and click on Sync now.

That command will sync your system time with current time zone.

Now I am able to connect to MongoDB atlas.

2 Comments

Thank you for the straightforward solution to my issue that brought me to this question. I was trying to run the "realm-cli login" command and kept getting the error "login failed: Post ... x509: certificate has expired or is not yet valid: current time 2023-05-19T19:37:18+04:00 is before 2023-05-19T17:04:55Z". Soon after syncing system time. I was able to run "realm-cli login" successfully.
I faced the same issue on my WSL2 + Ubuntu 22.04 box. I was able to connect after issuing the command: sudo hwclock -s

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.