Can't initialize rotatable log file

I have a problem while trying to mongod.exe from my PC:

I want to connect to atlas from my computer.
I have Windows 10 and this is an Administrator command prompt.

This is my mongod.cfg:

    # mongod.conf

    # for documentation of all options, see:


    # Where and how to store data.


      dbPath: F:\MongoDB\data


        enabled: true

    #  engine:

    #  wiredTiger:

    # where to write logging data.


      destination: file

      logAppend: true

      path:  C:\Program Files\MongoDB\Server\5.0\log\mongod.log

    # network interfaces


      port: 27017







    ## Enterprise-Only Options:


MongoDB Shell Version:
    MongoDB shell version v5.0.3
    Build Info: {
        "version": "5.0.3",
        "gitVersion": "657fea5a61a74d7a79df7aff8e4bcf0bc742b748",
        "modules": [
        "allocator": "tcmalloc",
        "environment": {
            "distmod": "windows",
            "distarch": "x86_64",
            "target_arch": "x86_64"

I’d appreciate your help.

Hi Elitzafan_Ratzon from the error “FileNotOpen” it looks like it couldn’t create the file in the path C:\Program Files\MongoDB\Server\5.0\log\mongod.log. I would verify two things first

  1. You have created C:\Program Files\MongoDB\Server\5.0\log\ directory so mongodb can create the log file.
  2. That the user that is running mongodb has access to create files in the log directory.

I deleted the log file, and run mongod and the file was created again.

1 Like

Thank G-d.
I installed mongosh and managed to connect.
I also looked for the mongodb service and found it running,
then I tried to run:
mongo “mongodb+srv://” --username m001-student
and enter the password and now I’m connected.

Thank you tapiocaPENGUIN.

1 Like

My concern here is why do you start mongod? I asked because the mongo command you shared is to connect to an Atlas cluster. You are not connecting to your local instance that you started. You might be using resources on your computer that you really do not need to use.

You are right. I can see now that I made a mistake.
I thought you have to start mongod for mongo command to work because of what posted here.