Failed to connect mongo shell with mongod

Failed to connect mongo shell with mongod
0

Hello there,

I did my research for almost a month now and still failed to connect them both through mongo shell, when I am trying to do so I am getting a waiting for connections on port 27017 with mongod and getting warnings on mongo shell saying user is not allowed to do action [getLog] on [admin.] .

I already created a data folder for mongod, and already have an admin access through atlas with read and write for the database, and already ran cmd as an administrator. every single video that I watched on youtube they go through the process with no problem, once they sign in through mongo shell the waiting for connections on port 27017 becomes a successful connection except my 2 computers that I did the test on does nothing at all.

I will almost hit my head through the wall. any answer will be appreciated. Thank You.

Uhm, when you say this:

my 2 computers that I did the test on

you mean you have your mongod running on one and you try to connect to it from the other?
Or you tried to the same process on two different computers?

Unfortunately i am not on windows, however it would be useful to know which command you are try to execute and how (something like this i guess: mongoDB - getLog )^^

Well, I am trying to do the same process on both computers Laptop and a PC on windows 10. I just want to get a successful connection between one computer and the server through atlas that is it. I am signing through mongo in cmd using mongo “mongodb+srv://cluster0-pgp0d.mongodb.net/test” --username AndrewAlkazeer and I get a connection but mongod still saying waiting for connections on port 27017.

When I was doing my research on stack over flow one of those people who replied to the post mentioned to use “docker run --rm -p 27017:27017 mongo” and said it worked, where do I use that code?
I know you are not on windows and thank you for replying but hopefully another person read that post and know what it does and where to put it on.

docker run --rm -p 27017:27017 mongo

This is related to docker stuff, you can’t use it here :frowning:

That said, probably there is a misunderstanding here: that connection string is used to connect to atlas, which is a cloud database. That means that you are connecting to their mongod, somewhere on their server ( actually it is not a mongod but i think it can help you understand what is going on).

To connect to the mongod on your pc things are different: on my env i just need to open a new terminal, digit ‘mongo’ and it connects to the mongod running on my system ( by default both points to port 27017)^^.

If you want to authenticate yourself you can use the flags --username and --password ( and – authenticationDatabase if you want to specify the database), but all these stuff are needed only if you have already created a user on localhost.

1 Like

thank you very much for those info :slight_smile:

1 Like