Start mongo from Windows command file

install mongodb windows 10
start mongodb linux
start mongodb ubuntu
how to start mongodb in terminal
service mongodb server failed to start
mongodb documentation
unable to start mongodb in windows
mongodb tutorial

I created a command (start.cmd) file with the following contents:

c:\pymon\mongodb\bin\mongod.exe --dbpath c:\pymon\mongodb\data

But all it does is open a new blank command shell.

I then tried:

cmd /c c:\pymon\mongodb\bin\mongod.exe --dbpath c:\pymon\mongodb\data

But that does the same thing.

All I want is to start mongo using my own database path without having to specify the dbpath. I thought it could be done with a configuration file, but reading the documentation you've got to supply a parameter to mongod.exe to use the config file meaning my above cmd file still wouldn't work.

What am I doing wrong? any other program starts fine using the above.

Thanks.

Run MongoDB as a Service in Windows - stackFAME, Start CMD, Command Prompt as Administrator and create following directories, if you haven't created already. create the config file in mongodb installation folder,​  For development purpose, you can reduce the initial data files size of MongoDB server and limit the maximum data files size up to 512MB with --smallfiles option. This option also can reduce the maximum file size of each journal files from 1GB to 128MB. mongod --smallfiles. Note: --smallfiles option is not recommended for production server. Start MongoDB with Command Line Options. You can start the MongoDB server with all above options in one command line.

create a batch file ...bat with

start call "C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe"
start call "C:\Program Files\MongoDB\Server\3.4\bin\mongo.exe"

Install MongoDB Community Edition on Windows, If You Installed MongoDB as a Windows Service. From Windows Explorer/File Explorer, go to C:\Program Files\MongoDB\Server\4.2\bin\ directory and double-click on mongo.exe . Or, open a Command Interpreter with Administrative privileges and run: "C:\Program Files\MongoDB\Server\4.2\bin\mongo.exe" To start MongoDB, run mongod.exe from the Command Prompt navigate to your MongoDB Bin folder and run mongod command, it will start MongoDB main process and The waiting for connections message in

In both the approaches, you are spinning off a shell that starts the mongod process and exits. Have you considered using Mongodb as a windows service?

The --install option of mongod.exe can help you set it up. Refer here

Edit: Actually, what I said above isn't true. I could get a cmd file to work.

start.cmd

"c:\Program Files\MongoDB 2.6 Standard\bin\mongod.exe" --dbpath c:\mongodbdata\temp

The mongo Shell, –logpath : the existent file path, used by mongo daemon process,for flush out loggs now type following command to start the mongod process  Start/Stop MongoDB using the Windows services Support for installing MongoDB as Windows service comes out of the box. MongoDB daemon executable provides amazing support for the installation of services using few command line parameters without using additional components for this purpose Just we need set the few command line params and we are way to go.

If you run my command from File explorer it works fine, but from a command line it has the problem I created.

So, from a command line you can do:

cmd /c start.cmd

and it works.

Install, setup and start MongoDB on Windows – ajduke's blog, start c:\mongodb\bin\mongod --dbpath c:\mongodb\db start c:\mongodb\bin\​mongo -save as Duration: 2:31 Posted: Sep 18, 2014 Steps to run mongo as a window service. Open command prompt as administrator. Type cd C:\Program Files\MongoDB\Server\3.2\bin (check path properly, as you may have a different version installed, and not 3.2). Press enter. Type net start MongoDB. Press Windows + R, type services.msc and check if

A straightforward way is to create config file mongod.cfg that contains like below:

systemLog:
  destination: file
  path: C:\Program Files\MongoDB\Server\3.6\bin\data\log\mongod.log
storage:
  dbPath: C:\Program Files\MongoDB\Server\3.6\bin\data\db
net:
  bindIp: 127.0.0.1
  port: 27017

then run this command in the bin folder inside mongodb:

mongod --config mongod.cfg

If you want to install as MongoDB service you should run like this, be sure to write absolute path for mongod.cfg:

mongod --config "C:\ProgramFiles\MognoDB\Server\...\bin\mongod.cfg" --install

If you don't mention absolute path in the command or inside config file when you want to install as windows service, it will give error. Then you can start MongoDB service with:

net start MongoDB

run mongodb using batch file and cmd easy, Microsoft Windows 7; MongoDB 3.2.9. Start MongoDB without Command Line Options. We can start MongoDB server without any command line options by You can specify the MongoDB server to write the logs to a log file. Start MongoDB Community Edition as a Windows Service¶ Starting in version 4.0, you can install and configure MongoDB as a Windows Service during the install, and the MongoDB service is started upon successful installation. You can also manually manage the service from the command line.

How to Start MongoDB with Command Line Options, To start MongoDB Server in Windows, start Mongo Daemon (mongod.exe) especially the installation folder as C:\Program Files\MongoDB\Server\4.0 . start Mongo Daemon (mongod.exe) using the following command:  Put your mongo script into a .js file. Ex: Quite literally.. you take the exact same commands you would input to the mongo shell, save those commands to a .js file, and pass it as a parameter to the mongo command.

How to Start MongoDB Server - mongod.exe, It's always easy to create a batch file to start MongoDB, and it's best to create a script file to start Mongo. To begin using MongoDB, connect a mongo.exe shell to the running MongoDB instance.Either: From Windows Explorer/File Explorer, go to C:\Program Files\MongoDB\Server\4.2\bin\ directory and double-click on mongo.exe. Or, open a Command Interpreter with Administrative privileges and run: copy copied

Setting up a batch file for MongoDB, The three ways to start programs. Specify a program name. c:\windows\notepad.​exe. In a batch file the batch will wait for the program to exit. Note : While using the command prompt on some Windows OS like windows 7 or Windows server 2008, Run it with administrator privileges as shown as follows Use the following commands to start the

Comments
  • Did you try using a batch file (.bat) ?
  • Do you have the directory c:\pymon\mongodb\data created and with the correct access ? Did you try just running the command from command line ? What do you get ?
  • great it,s help thank's
  • What is the contents of your cmd file then?
  • Sorry - hit save too soon.
  • thanks for your help, it made me realise in a roundabout way what I did wrong. see my own answer.