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

$ 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.

Related

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

Mongo is unable to start

I'm trying to start mongo uin windows10 by type: mongo in cmd.
I am getting this error:
C:\Users\Itzik>mongo
MongoDB shell version v3.4.1
connecting to: mongodb://127.0.0.1:27017
2016-12-26T19:00:16.604+0200 W NETWORK [main] Failed to connect to 127.0.0.1:27017 after 5000ms milliseconds, giving up.
2016-12-26T19:00:16.605+0200 E QUERY [main] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:234:13
#(connect):1:6
exception: connect failed
C:\Users\Itzik>
I have opened port 27017 in the firewall,
and restart mongo's services
and it still dont work.
what could it be?
Have you started the server? Mongodb follows a server-client architecture. mongo is the client, but before it is started you need to start mongod, which is the server.
If you haven't, start the server in advance in a different console:
mongod --dbpath "c:\data"
replacing c:\data by any folder where you want to store your data (you need to create the folder in advance).
If mongod is not in the path look in the installation path, it should be something like C:\mongodb\bin\mongod.exe.
When the server says something like 'waiting for connections', then you can go to another console and type mongo to start the client.
In C:\Program Files\MongoDB\ you might not have permission to create file/folder for your user. And mongo installer cannot create it because of lack of Administrative permission for your user.
So in C:\Program Files\MongoDB:
Create a folder named data
Create a folder named db inside the folder data
Now right click on the data folder and choose properties
Click security tab and select your user there
Click the Full control select box
Click ok, ok, ok ...
important! if you don't have the path "C:\Program Files\MongoDB\Server\3.4\bin" set in environment variable, please set it.
Now go to shell and type : mongod --dbpath "C:\Program Files\MongoDB\data\db"
That's it :)
First start the server.
Goto your installation path. Mine was in "Program Files/Mongodb/server/bin"
You will find a "mongod.exe" application.
However, the server will look for "C:/data" folder for all the databases.
So create the "C:/data" folder.
Now start the mongod.exe using command prompt.
>>mongod
After this you may start the client
>>mongo
This worked out for me.
Open the terminal as Administrator.
(You can simply do this by searching cmd in start and then right click and select "Run as administrator")
Go to bin directory of your MongoDB folder.
cd C:\Program Files\MongoDB\Server\3.4\bin
Type following command to start mongodb server :
mongod --dbpath "C:\Program Files\MongoDB\Server\3.4\bin\Data"
now, server will be waiting for connections.
Open a new command prompt(again as Administrator)
Go to bin directory.
cd C:\Program Files\MongoDB\Server\3.4\bin
Type following command:
mongo
This will show you a prompt of mongodb :
>
Thanks.
if u install by brew (on osx)
first run sudo mkdir /data/db
start mondoDB Daemon by typing mongod (leave it open) and then
run mongo by typing mongo in new terminal tab
I also have faced the same problem.
First i have typed mongodb in my command prompt ,It displays "waiting for connection on 27017" that means it is working.
Then i type mongo in another Command prompt Window then above error occurred.
I was having both .dll files in my xampp\php\ext folder.
(php_mongo.dll and php_mongodb.dll)
I deleted Php_mongodb.dll and also it's extension from php.ini file.
Again restart command prompt,Type mongod and then mongo
Now working correctly.
First set the path in Enviroment Variables, C:\Program Files\MongoDB\Server\3.6\bin
after that use bellow command
C:\>mkdir data
C:\>cd data
C:\data>mkdir db
C:\data\db>
Then go to bin directory and select mongod.exe or use mongod. Without closing previous cmd
open a new cmd and start the client using mongo
Now it will work.
This issue is resolved by creating a data directory
Then move to the bin folder of mongodb or setting path information in environment variables
Then you can enter the following command,
mongod --dbpath 'path of the data folder including data directory name'
Eg: mongod --dbpath c:\users\codemaker\data

Cannot open Mongo shell on Ubuntu

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

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

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