MongoLab error - 'mongo not found' - mongodb

I am hosting an app on heroku and I'm trying to connect it to the MongoDB database using the MongoLab addon. One of the steps is to type:
mongo ds044064-a0.mongolab.com:44064/heroku_w6fhwppg -u <dbuser> -p <dbpassword>
But I keep getting the error "mongo not found" Anyone have any ideas why? The add-on is installed.
Thanks!

mongo refers to the mongo shell binary, which you'll need to install locally. It, along with all the other MongoDB binaries, can be downloaded here:
https://www.mongodb.org/downloads

Related

MongoDB: Atlas connection problems with Mongo Tools

Hey I am learning how to use a Mongodb Atlas using shell commands.
I can successfully connect to my Atlas cluster via Mongo Shell. Unfortunately I can't do it with Mongo Tools (mongoimport, mongoexport, mongostat).
If I execute this command:
mongostat --uri mongodb+srv://m001-student:m#####s#sandbox.####.###.mongodb.net
I receive:
error parsing command line options: error parsing uri:
lookup sandbox.#####.mongodb.net on 127.0.0.53:53: cannot unmarshal DNS message
The same problem repeat itself for other commands. I don't know if it is important but I use Ubuntu 18.04 on a uni network.
I tried to search for any solutions but I couldn't find anything useful. Changing resolv.conf as was suggested here did not achieve anything except cutting my network connection :P
Anyone have any idea?
Well it is more of a workaround than real answer but my solution is to not use command line tools provided by Atlas website and don't use srv connection.
mongostat --host "sandbox-shard-####.gcp.mongodb.net:27017,
sandbox-shard-####.gcp.mongodb.net:27017,
sandbox-shard-#####.gcp.mongodb.net:27017"
--authenticationDatabase admin --ssl --username ##### --password #####
Worked for me.

mongodb: Auth mechanism not specified

I followed the instructions here for setting up users...
Then from another machine I do:
mongo -u admin -p adminpassword host/collection
The response I get is:
MongoDB shell version: 2.6.10 connecting to: host/collection
2019-07-12T06:20:36.336+0000 Error: 2 { ok: 0.0, errmsg: "Auth
mechanism not specified", code: 2, codeName: "BadValue" } at
src/mongo/shell/db.js:1287 exception: login failed
Now, I suppose this is an issue with different versions but what I'm really after is to remote connect from a node script and that's failing as well but the only message is: "MongoError: Authentication failed."
Does anyone know a solution?
Ran into the same issue when using an old Mongo shell version (2.x/3.x) with a 4.0+ server. Upgrading the Mongo shell to 4.0.6+ seems to have resolved the issue.
My guess is the protocol to authenticate and specifying auth mechanisms has changed in newer server versions.
Maybe is because you've tried to connect with admin user on a different collection than admin.
Try mongo -u ADMIN_USERNAME -p ADMIN_PASSWORD HOST_IP/admin

Generating DRDL file for MongoDb Atlas for use with MongoDb Bi Connector

I am trying to set up Mongo Db Bi Connector in order to carry out some analytics on my MongoDb Atlas Cluster. I am following the instructions here: https://docs.mongodb.com/bi-connector/master/tutorial/connecting-to-atlas/
However, when trying to generate the DRDL file as specified running the following (with my information):
mongodrdl --host <domain0>.mongodb.net:27017,<domain1>.mongodb.net:27017,... -u <username> -p <password> --ssl --authenticationDatabase=admin -d <database>
I get the following error:
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/bin/mongodrdl
Reason: image not found
Abort trap: 6
I am not sure what is the cause of this or what it means.
Any help would be appreciated.
MongoDB Atlas uses TLS/SSL to encrypt connections and enforces authentication by default.
MongoDB Connector for BI supports TLS/SSL and requires SSL library to be installed. See also the Installation step for installing OpenSSL on the manual
Assuming you're using OSX, then you can run the following:
sudo brew update && sudo brew install openssl

Mongorestore command not found with meteor

Ok guys I receive a bunch of files of a mongodb (.bson and .json) I want to replace my current meteor mongodb, I have read al this post about it:
meteor: how can I backup my mongo database
Mongorestore, from meteor production server to local
Restore a mongodb in meteor production server
MongoDB: mongorestore: command not found (this actually have nothing to do with my problem)
and I end writing in my terminal while meteor app was running
mongorestore -h 127.0.0.1:3001 --port 3001 -d meteor ~/Github/mongo/mongoDBRESTORE/admin/
but the problem its that terminal output is not command found
does anybody know what Im doing wrong, what its the right way to do this?
As #rgoomar pointed in the comments I need to download https://www.mongodb.org/downloads the mongodb bin files then I simple execute ~/mongodb/bin/mongorestore -h 127.0.0.1:3001 -db meteor ~/Github/mongo/mongoDBRESTORE/admin
and worked!

mongoDB test error

I came to know about mongoDB and looked for test.So I made it install and then for test when I used command mongo on terminal it showed an error like this
MongoDB shell version: 1.8.2
connecting to: test
Sun Jul 31 01:06:07 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:79
exception: connect failed
So can someone tell me what is the problem.I am using ubuntu 11.04.For installation instruction I had used this site.I am newbie to this mongoDB so please helpe me.Any help will be highly appreciable.
All you need to do is open 2 terminal tabs. In one, run
mongod
which starts the MongoDB server.
In the other, run
mongo
which is the shell that connects to your MongoDB server.
It looks like MongoDB isn't running. Can you connect to the web interface in your browser?
http://localhost:28017
Also, do you see the process running on your machine? You should see an entry for mongod when running ...
$ top
or
$ ps aux
why not install mongodb from 10gen's own debian repository? much easier and more likely to work
http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages
To see if mongodb is running, this also helps:
sudo service mongodb status
if it is running, and you still get the same error, then it must be the weird localhost bug that mongodb has. it assumes localhost is 127.0.1.1 for some reason. try
mongo 127.0.1.1
I had the same problem. Just try to create folder c:\data and next c:\data\db