Mongo not running post db.shutdownServer()


I have issued db.shutdownServer() from admin DB within from mongo shell on Windows localhost. Post this i have to run mongod for every terminal session whenever i am using the command prompt. Do i need to restart my machine for the deamon to run in background without me invoking it everytime on a separate terminal.

Also is there any process similar to --fork which can be used for Windows cmd.


Hey @Chetan_Prakash_59365

I believe you should be able to use the --fork option even if on Windows. Also did this course not come with a vagrant VM for you which runs linux?

Yes using vagrant for this chapter, however working on localhost as well to replicate everything on Windows whatever commands we are using on LinuxBox.

Also i dont see --fork in General options in help section for the deamon. see below.

General options:
-v [ --verbose ] [=arg(=v)] be more verbose (include multiple times
for more verbosity e.g. -vvvvv)
–quiet quieter output
–port arg specify port number - 27017 by default
–logpath arg log file to send write to instead of
stdout - has to be a file, not
–logappend append to logpath instead of
–logRotate arg set the log rotation behavior
–timeStampFormat arg Desired format for timestamps in log
messages. One of ctime, iso8601-utc or
–setParameter arg Set a configurable parameter
-h [ --help ] show this usage information
–version show version information
-f [ --config ] arg configuration file specifying
additional options
–bind_ip arg comma separated list of ip addresses to
listen on - localhost by default
–bind_ip_all bind to all ip addresses
–ipv6 enable IPv6 support (disabled by
–listenBacklog arg (=2147483647) set socket listen backlog size
–maxConns arg max number of simultaneous connections
- 1000000 by default
–pidfilepath arg full path to pidfile (if not set, no
pidfile is created)
–timeZoneInfo arg full path to time zone info directory,
e.g. /usr/share/zoneinfo
–keyFile arg private key for cluster authentication
–noauth run without security
–transitionToAuth For rolling access control upgrade.
Attempt to authenticate over outgoing
connections and proceed regardless of
success. Accept incoming connections
with or without authentication.
–clusterAuthMode arg Authentication mode used for cluster
authentication. Alternatives are
–slowms arg (=100) value of slow for profile and console
–slowOpSampleRate arg (=1) fraction of slow ops to include in the
profile and console log
–networkMessageCompressors [=arg(=disabled)] (=snappy)
Comma-separated list of compressors to
use for network messages
–auth run with security
–clusterIpSourceWhitelist arg Network CIDR specification of permitted
origin for __system access.
–profile arg 0=off 1=slow, 2=all
–cpu periodically show cpu and iowait
–sysinfo print some diagnostic system
–noIndexBuildRetry don’t retry any index builds that were
interrupted by shutdown
–noscripting disable scripting engine
–notablescan do not allow table scans

This course has you running up to 9 mongod processes just FYI.

And I was wrong --fork is not available in windows as I have read here.

In that case see the docs here to run it as a service in Windows.

Found this post to

Thanks for the suggested links.
Now going back to my initial question am clarifying the doubt again in steps below.

  1. i have ran command “db.shutdownServer()” from one of my terminals.
  2. Log file in bin folder reflects the shutdown process.
  3. Now as per my understanding i need to run “mongod” again once to start my deamon process for all my corresponding mongo executables.
  4. However i need to run “mongod” for all new cmd sessions everytime and also my logfile is not getting appended post the first step i.e. post shutdown.

Any suggestions as to how mongod gets shutdown and starts as a deamon service again.


Not if run as a service


You will have to start the service again

Thanks again for the info for starting mongod as a service.

Now my only remaining questions is related to the log file in bin folder which is not getting updated by its own.

Tried running mongod using --logappend as well, still not working.
Just to add here logappend is set to True in the mongod.cfg with the same logfile path.

Are you sure it is going to the same --logpath


see below…


for documentation of all options, see:

Where and how to store data.

dbPath: C:\Program Files\MongoDB\Server\4.0\data
enabled: true




where to write logging data.

destination: file
logAppend: true
path: C:\Program Files\MongoDB\Server\4.0\log\mongod.log

network interfaces

port: 27017






Enterprise-Only Options:



Sorry I do not know then…

Hi @Chetan_Prakash_59365,

Can you please check if you have appropriate permissions on the folder that contains your log file and let me know if the issue isn’t resolved?

Curriculum Support Engineer

Hi ,

I have the required permissions on the log file folder as it is on my local machine disk only.

This seems to be a strange issue and is being faced by some other folks as well.


This issue can be termed as closed now as log file is now getting updated.

Hi @Chetan_Prakash_59365,

Can you please share how you were able to resolve the issue and the steps you followed for the same?

Curriculum Support Engineer

1 Like

Had some admin rights issues within windows. Sorted those out and everything is running fine now.

1 Like