Failed to open the configuration file

i need to open the configration file on my local pc in the terminal ‘windows’ but i can’t do that by

vi mongod.conf

Hi @Mohamed_Hassan2,

Welcome to the MongoDB University forums :sparkles:

In windows, its mongod.cnf instead of mongod.conf

And as per the documentation, by default it is meant to be located at <install directory>\bin\mongod.cfg in the Windows OS.

Please make sure that you are on the right path directory to edit the configuration file and if the issue still persists, please share the screenshot with us.

Thanks,
Kushagra

thanks for your reply :slight_smile:

i am on the right path … when i edit the mongod.cfg file by adding the security field it says i have no access to edit this file

So, how can i edit the mongod.cfg file plz

Hi @Mohamed_Hassan2,

You can change the permission of the file while going to that particular folder, and do right-click on the mongod.cnf file and go to the properties option, a dialog box will appear like this:

Click on the Edit option choose your username and mark tick on allow checkbox in Full Control.

Click on OK and now you have full control to edit the file.

I hope it helps!

Thanks,
Kushagra

1 Like

i did that but when i try to edit it, it gives me that:
image

I think you need admin privileges.Who is the owner of the file
Why do you want to edit this file.It will be used by your windows service
I suggest you spin up your own mongod on a different port ,dbpath,logpath and do your task like below
mongod --port 28000 --dbpath your_homedir --logpath your_homedir/log
Note this runs your mongod in foreground so you have to open another cmd window to connect