Lab - Change the Default DB Path problem with validate

Error in validate_lab_change_dbpath

vagrant@m103:/var/mongodb$ ls -l
total 4
drwxrwxrwx 2 vagrant vagrant 4096 Feb 17 17:43 db
shared => miconfig-2.cfg

  dbPath: "/var/mongodb/db/"
  destination: file
  logAppend: true
  path: "/var/mongodb/db/mongod.log"
  bindIp: ","
  port: 27000
  authorization: enabled
  fork: true
vagrant@m103:/var/mongodb/db$ mongod --config /shared/miconfig-2.cfg --port 27000
vagrant@m103:/var/mongodb/db$ mongo --port 27000
MongoDB Enterprise > use admin
MongoDB Enterprise > db.createUser({
    user: "m103-admin",
    pwd: "m103-pass",
    roles: [
      {role: "root", db: "admin"}
MongoDB Enterprise > db.auth( 'm103-admin', 'm103-pass' )
MongoDB Enterprise > db.getUsers()
                "_id" : "admin.m103-admin",
                "user" : "m103-admin",
                "db" : "admin",
                "roles" : [
                                "role" : "root",
                                "db" : "admin"
vagrant@m103:/var/mongodb$ validate_lab_change_dbpath
You need to specify the dbPath as /var/mongodb/db.

I created the folders
I have assigned the permissions
I have connected with mongod without problems
I have connected with mongo without problems
I created the user 'admin' without problems
but 'validate_lab_change_dbpath' does not work

I have looked in the forum and tried everything they said, but it does not work

Can you help me?

dbPath: “/var/mongodb/db/” -> dbPath: “/var/mongodb/db”

1 Like
I just changed the directory as you told me
I have closed the mongo and mongod
I reconnected with the file and the same error comes out
I have tried everything and nothing, it does not work

ps -ef | grep mongod
if any pid kill them and retry

It is done

I have done all the steps from the beginning with the modified file and it has worked for me

thank you!!!!
1 Like

This is strange that initially working all the steps it did not work but later again re-working on all steps, it worked. Is there anything that change between the two efforts, curious to know.

dbPath: “/var/mongodb/db/” => dbPath: “/var/mongodb/db”

in the configuration file I removed "/" at the end of the route as they told me and I did all the same steps from the beginning and it worked

I killed mongod process, then removed and re-make the /var/mongodb/db folder, rebooted the mongod and now the validation is fine

Hi Patrica,

Could you tell me where did you kept the mongodb.conf file? Still
I am unable to validate the validate_lab_change_dbpath

You can keep config file anywhere you can read/write.Just need to give full path when starting mongod in case you are starting it from another location
If you are at same dir as where your file resides just run mongod -f configfile_name
Place it on /home/vagrant or /shared

1 Like


I cant config the file, it is in the same location where run mongod.
¿could you what i am missing?
thanks in advance

Directorio de C:\Users\elval\m103\m103-vagrant-env

23/07/2019 01:27 a. m. .
23/07/2019 01:27 a. m. …
19/07/2019 03:19 p. m. .vagrant
23/07/2019 01:27 a. m. 273 ArCon
23/07/2019 12:29 a. m. 92,216,793 cat.json
23/07/2019 12:49 a. m. dataset
19/07/2019 03:12 p. m. 5,915
19/07/2019 02:30 p. m. 4,876 provision-mongod
19/07/2019 03:30 p. m. shared
19/07/2019 02:30 p. m. 811 Vagrantfile
19/07/2019 03:12 p. m. 766,964 VirtualBox&Vagrant_Windows.pdf
6 archivos 92,995,632 bytes
5 dirs 185,344,561,152 bytes libres

C:\Users\elval\m103\m103-vagrant-env>mongod --config ArCon
Unrecognized option: storage
try ‘mongod --help’ for more information

C:\Users\elval\m103\m103-vagrant-env>mongod -f ArCon
Unrecognized option: storage
try ‘mongod --help’ for more information

C:\Users\elval\m103\m103-vagrant-env>mongod -f cat (this is another file)
Error reading config file: No such file or directory
try ‘mongod --help’ for more information

C:\Users\elval\m103\m103-vagrant-env>mongod -f cat
Unrecognized option: type
try ‘mongod --help’ for more information

Hi @Lara_18146,

Please provide the complete path of the config file that you are using along with the appropriate file extension with which you have saved your file (for eg: mongod -f /shared/config1.conf).
Let me know if it doesn’t work.

Curriculum Support Engineer

Hi all,

I’m have a problem with this Lab.
I can’t start mongod --config “/etc/mongod” --port 27000 with vagrant user, only root user, but the validation is wrong?

what I do? Anyone had the same problem?

Hi Lara,
First you have to up the vagrant with provision box name by running a command (C:\Users\elval\m103\m103-vagrant-env>vagrant up --provision).
Then you have to ssh the vagrant using a command (C:\Users\elval\m103\m103-vagrant-env>vagrant ssh).
Then it will connect to the virtual box (i.e. ubuntu with command prompt vagrant@m103:~$).
At that point you have to start mongod or mongo or etc.

1 Like

Thank you very much for helping me. I’ll keep trying

Thank you Muskan for answering, I´ll let you know if it works.

Hi @Jessyre,

Please prefer to create your config file in some other directory rather than “/etc/”.
Also, can you please share a screenshot of the error that you are getting so that I can understand your issue better?

Curriculum Support Engineer


Thank you for your answer, I coud resolved this problem, I only create a new file with user vagrant, when I did it the “mongd -f” started without problem.

I keep having trouble configurating a file in chapter 1,and a node in chapter 2
I do know that I´ll have to repeat the course but I would apreciate if someone could send me a link, book, or something that can help me understand how to configurate.
Thank you.

The following is my go to document for this.