Cannot open Mongo shell on Ubuntu - mongodb

I've installed MongoDB on Ununtu 14.
How do I open the its shell?
I followed this: https://docs.mongodb.com/manual/mongo/, which told me to run ./bin/mongo in my Mongo installation directory. Afaik the Mongo installation directory in my computer is var/lib/mongodb, but I don't see any "bin" directory in there, just the following files and directories: journal, local.0, local.ns, mongod.lock, storage.bson, _tmp.
Any help will be profoundly appreciated!

The folder you are looking into is not the mongodb installation folder, but where it stores the data.
If you have installed mongodb through package manager, you can do (to make sure mongodb is running):
sudo service mongod start
And then just use the
mongo
command, as it should already be on your path
You can check here for more information

Related

What means this error in MongoDb running mongodb package for the first time?

$ mongo
BadValue: error: no args for --configdb
try 'C:\Program Files\MongoDB\Server\6.0\bin\mongos.exe --help' for more information
mongod says waiting for connections on port 27017. Whats the problem with mongo?
My path to mongo is: alias mongo="/c/Program\ Files/MongoDB/Server/6.0/bin/mongos.exe"
For everybody with the same problems of MongoDB installiation on Windows accordingly Udemy course of Full stack Bootcamp.
Download current version of Mongodb community server (msi) save it in Program files->Mongodb folder then you should download (https://downloads.mongodb.com/compass/mongodb-mongosh_1.5.1_amd64.deb) MongoDB shell because in 6.0 version or later there is no mongo.exe. save it to Mongodb folder. Save the variables mongod and mongosh via vim or interface tools (.dash_profile). I created via vim. Mongod variable is path to you mongod.exe and mongosh is the path to mongosh.exe. and run the mongod and mongosh in separate terminal tabs. For me it was necessary to rename mongorc.js to mongoshrc.js I used mv mongorc.js mongoshrc.js and that's all. Please be attention if you have old .bash_profile. You need to remove them (rm) because it grabs the first one. Check the list with ls -a.
download the shell from latest version here:
https://www.mongodb.com/try/download/shell?jmp=docs
mongo is change to mongosh, extract the folder in your desire directory, and change your "atlas mongos" path to "mongosh.exe" path. "mongosh.exe" path will be in bin folder of the downloaded zip file.

Running an instance of mongod from terminal ends with "[initandlisten] shutting down with code:100"

I've been searching for an answer for a week now and haven't found out how to keep this from happening. I currently have mongo stored from my root directory into a file with path /data/db. The contents of this directory after typing ls...
Contents of /data/db
After I run the command mongod I see this...
After running mongod
I've installed mongodb with homebrew and have followed the installation rules over and over after installing and uninstalling thinking I made a mistake. I'm stuck and am new to mongodb altogether. I've noticed that Homebrew is installed in /usr/local/ and I believe mongo is stored in /data/db/.
I think there is some permission issue. Try changing the group and owner of the directory and the directory where socket file is being created through the command
sudo chown mongo User:mongo User data/socket directory

Install Mongodb on windows 7 - 64 bit

I am new to mongodb and not getting how to install it since i dint find videos or any helpful resources to achieve the same. Please help me for installing mongodb on windows 7 with the exact steps. I tried downloading recent version of mongodb from the site and its unsuccessful. Thanks in adcance.
Regards,
Vijay
Steps:
Download MongoDB this link link.
Review MongoDB folder.
In MongoDB, it contains only executable files 10 Plus(exe) in the bin folder. This is true, and That are the required files to MongoDB, it's really hard to believe for a developer like me Who eats from a relation database background.
path:- Files under $MongoDB/bin folder
Configuration File
Create a MongoDB config file, it’s just a text file, for example C:\mongodb\mongo.config:
#store data here
dbpath=C:\mongodb\data
\\all output go here
logpath=C:\mongodb\log\mongo.log
\\log read and write operations
diaglog=3
Run MongoDB server
Use mongod.exe --config C:\mongodb\mongo.config to start MongoDB server.
C:\mongodb\bin>mongod --config C:\mongodb\mongo.config
All output going to: C:\mongodb\log\mongo.log
Connect to MongoDB
Uses mongo.exe to connect to the started MongoDB server.
C:\mongodb\bin>mongo
MongoDB shell version: 2.2.3
connecting to: test
//mongodb shell
MongoDB as Windows Service
Add MongoDB as Windows Service, so that MongoDB will start automatically following each system restart.
Install as Windows Service with --install.
C:\mongodb\bin> mongod --config C:\mongodb\mongo.config --install
A Windows service named “MongoDB” is created.
To start MongoDB Service:
net start MongoDB
To stop MongoDB Service
net stop MongoDB
To remove MongoDB Service
C:\mongodb\bin>mongod --remove
Reference Link Install Mongodb
For mongoDB 4.x, I got installation hung up several times in "wait for a few minutes..."
I changed to v3.2.21-1 as recommended from searching the answer from web. It installed very quick and fast as I installed one year ago.
firstly you downloaded mongodb from here : https://www.mongodb.com/download-center?jmp=nav#community
you unzip the folder in your directory example C:\..\MongoDB
you open the command prompt ( demarrer>Invite commande)
you go to your folder where the bin is and you write this on your command prompt : cd c:\..\mongodb\bin
then you have to specifies the directory where you want to put the data, you can create a folder called : MongoData, and you whrite on your command prompt: Mongod --dbpath C:\..\MongoData
Download the version 4.0.22 from here
And follow steps from Use this tutorial to install MongoDB 5.0 Community Edition on Windows using the default installation wizard
All the best!!!
use mongodb-win32-x86_64-2008plus-ssl-3.2.22-signed for Windows7 64 bit

mongodb on ubuntu 14.04 default data/db path

I am trying to install mongodb on Ubuntu 14.04.
I am new to linux. I figured out how to install ubuntu and become su to the root as well as how to set up environment path
I am just wondering where exactly the default path suppose to be for mongodb.
should I use root and put the data/db in the root directory?
When I install the mongo db it tell me to run the sudo mongo install (don't remember exactly what the command is) it runs and installs, A mongodb folder then appears in the system where etc folder is. also there is a folder in /var/lib/mongodb.
also I have to chmod 777 for the data/db I don't think I was able to do this.
So where exactly data/db suppose to reside by default?
You should take a look at mongod.conf file.
Default working directory should be "/data/db" - if is now exist - just create is. No need to chmod 777 if you create the directory and run mongo as root user.
If you want to start mongod with other working directory - modify mongod.conf file or start mongod with --dbpath /pathtootheremptyfolder/
Please let me know if you are OK.

connecting to test mongoDB is failed

I am new in mongoDB
I have tried to install mongoDB on win 8 - 32 bit
I followed "The Definitive Guide To MongoDB 2010" by Apress.
I pasted the file in C drive root "mongodb-win32-i386-2.4.6"
Then I created nested folder in C
data/db ,
As the book was mentioned.
After that I opened cmd :
cd C:\ mongodb-win32-i386-2.4.6
cd bin\
up to here everything went well
then I tried to connect to mongo
but :
mongo
couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
occured.
Where is problem?
Thanks in advance
First Thing is
MongoDB is almost always run as a network server that clients can connect to and
perform operations on so
create a folder data and in that db folder i.e., c:\data\db
First we need to start the server with the command mongod.exe avial in your bin folder
like C:\mongodb-win32-i386-2.4.6\bin\mongod.exe
Run the mongo.exe avail in the bin folder like C:\mongodb-win32-i386-2.4.6\bin\mongo.exe
Know How to stop the mongod.exe
from the client we need to issue these commands
use admin
db.shutdownServer()
then automatically mongod will shut and you need to quit from client with exit command
HAVE A NICE DAY WITH MONGO
The database itself is an executable called mongod.exe (mongoDB daemon). First you need to start this one. When it is running, you can use mongo.exe (mongoDB shell) to connect to it and issue commands.
For more information, read the article "Install MongoDB on Windows" from the official manual.
i have tried the binary files from https://www.mongodb.org/dl/win32/i386
After installing above binary file please go to bin directory (C:\Program Files\MongoDB\Server\3.2\bin -> default installation directory) and run following command
mongod.exe --journal --storageEngine=mmapv1 --dbpath c:\data\db
Note:make sure that you have already created the c:\data\db directory
Also if you need a GUI interface for mongodb, you can use Mongobooster