I'm using Docker (running on WSL) and I have a MongoDB container running. Using mongo shell on my host I can connect to the instance, but I can't authenticate. I also get an authentication error when I try to go through MongoDB Compass, below is the error I keep getting. I've installed saslprep globally via npm on my host machine, but that didn't fix the problem either. Any help would be greatly appreciated!
> db.auth('admin-root', 'test')
Warning: no saslprep library specified. Passwords will not be sanitized
MongoError: Authentication failed.
I am receiving the below error when trying to connect to remote Mongodb Server using Robo 3T on my MacOS. Anyone have solutions to get rid of the mongod.lock as I can't find it in the path as well.
From the error it seems like you have not started mongodb in your system. First run your mongodb using following command in your system terminal and try connecting with Robo3T:
mongod
If you have not installed mongodb yet then first go through steps mentioned in below documentation, then start mongodb from terminal and then try connecting.
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
I have been trying to access my mongo instance from another machine, but I get this error. I could not find many references to this whatsmyuri error. This is what I get from the external machine:
$ mongo <IP_ADDRESS>:27017/youtube_advertising -u user -p password
MongoDB shell version: 3.2.0
connecting to: <IP_ADDRESS>:27017/youtube_advertising
2016-02-19T17:10:02.923+0100 E QUERY [thread1] Error: network error while attempting to run command 'whatsmyuri' on host '<IP_ADDRESS>:27017' :
connect#src/mongo/shell/mongo.js:226:14
#(connect):1:6
exception: connect failed
I have already changed the /etc/mongod.conf file, opened connections through port 27017 (with iptables) and restarted mongo. I am able to connect via ssh to that machine.
Searching about this whatsmyuri, I ran this command on mongo:
> db.runCommand( { whatsmyuri: 1 } )
{ "you" : "127.0.0.1:36990", "ok" : 1 }
I do not know if that 36990 port is right or wrong. Just in case I opened connections from there too, but still nothing.
Any ideas?
UPDATE
Checking the /var/log/mongodb/mongod.log, this is what I get when I try to connect from remote:
2016-02-19T10:41:07.292-0600 I NETWORK [initandlisten] connection accepted from <EXT_IP_ADDRESS>:51800 #2 (1 connection now open)
2016-02-19T10:41:07.310-0600 I QUERY [conn2] operation isn't supported: 2010
2016-02-19T10:41:07.310-0600 I - [conn2] Assertion: 16141:cannot translate opcode 2010
Check your versions. That may help.
I was having the same problem. In my case, the server was version 3.2.0-rc2, while mongo shell version was 3.2.1.
Upgrading the server to 3.2.1 fixed the problem.
This issue bit me when I was running two versions (3.4 and 4.2) of MongoDB on the same Windows 10 machine. I ran v3.4 mongod with no problems mentioned in the console output, but then running the v3.4 mongo shell produced the above error. Checking the Task Manager, it turned out there was a MongoDB process (I'm not sure, but I think it was for v4.2) running. After ending that process through the Task Manager, the v3.4 mongo shell ran fine with no error.
Using mongodb-community-shell
In MacOs brew install mongodb/brew/mongodb-community-shell
It will ask you to overwrite link with mongo command.
brew link --overwrite mongodb-community-shell
The issue arises when the mongo client's and server's version mismatch.
Uninstall MongoDB from the client and for installation follow the detailed instruction provided over here.
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
The key step which needs to be done with the attention is
sudo apt-get install -y mongodb-org=4.2.7 mongodb-org-server=4.2.7 mongodb-org-shell=4.2.7 mongodb-org-mongos=4.2.7
mongodb-org-tools=4.2.7
Note: In my case, the mongo version of server was 4.2.7
Another thing that one can do is uninstall MongoDB from both the systems taking necessary backups and install it again.
I am using laravel and I have a VM homestead set up in Vagrant. I have been having trouble connecting to my mongoDB database. I have so far added this extension to my laravel project with composer and followed its installation instructions. I have also also installed mongodb on homestead and it is reporting to be working. Now as I try to query something from my mongoDB I get the error:
MongoConnectionException in /home/vagrant/Code/flowtime/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Connection.php line 152:
Failed to connect to: localhost:29911: Connection refused
I have checked the connection info several times and it is correct. So could someone tell me if it is related to my VM setup or something else?
I am trying to install Mongo DB on a windows 8.1 64 bit machine and I a getting the following error.
C:\MongoDB\bin>mongo.exe
MongoDB shell version: 2.4.7
connecting to: test
Tue Nov 19 14:50:02.652 Error: couldn't connect to server 127.0.0.1:27017 at src
/mongo/shell/mongo.js:145
exception: connect failed
Make sure you have the daemon process running. You start it via mongod.exe. You are running the client side and by default connecting to port 27017 - the default mongo instance. Check your running processes for mongod first!
Make sure to unclick the download compass section when you download the shell. As soon as I unclicked it I was able to install the Mongodb shell. Hope this helps - I was stuck with this problem for a long time.