Lab: Logging To A Different Facility answer confusion

I first wanted to say a huge thank you to everyone who has been asking questions over the years. I’m going through these MongoDB courses and looking back at previous questions has been super helpful.

So after some trial and error I have successfully completed the Logging To A Different Facility lab, which has you using a configuration file to store logs in a new location. I was reading the instructions and one of them threw me off

* mongod is forked and run as a daemon (this will not work without specifying logpath)

I opened up the docs and they give me these instructions:

The following command starts mongod as a daemon and records log output to /var/log/mongodb/mongod.log .

`mongod --fork --logpath /var/log/mongodb/mongod.log`

So I went ahead and used that command and it kept giving me child errors, but isn’t that what the instructions are saying to do? Or am I not understanding? This is the process I took to solve the issue:

Setting the files:
dbPath: /var/mongodb/db
destination: file
logAppend: true
path: /var/mongodb/logs/mongod.log
bindIp: localhost
port: 27000
authorization: enabled
fork: true

The commands:
mkdir -p /var/mongod/db
mongod -f mongod.conf
mongo admin --host localhost:27000 --eval ' db.createUser({ user: "m103-admin", pwd: "m103-pass", roles: [ {role: "root", db: "admin"} ] }) '

… and that’s it. Can someone explain how I forked the data and ran it as a daemon without using --fork? Or is it because I ran it with -f?

You used config file and it has fork in it under process management
Regarding other command from command line also should work .Child process faild could be due to various issues.Since no dbpath is mentioned it will try to create datafiles under default dir /data/db If this dir is not existing it will fail
There could be already a mongod.log file in the given path or some permission issues
Show details from logfile or from your terminal