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:

    #   http://docs.mongodb.org/manual/reference/configuration-options/

    # Where and how to store data.

    storage:

      dbPath: F:\MongoDB\data

      journal:

        enabled: true

    #  engine:

    #  wiredTiger:

    # where to write logging data.

    systemLog:

      destination: file

      logAppend: true

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

    # network interfaces

    net:

      port: 27017

      bindIp: 127.0.0.1

    #processManagement:

    #security:

    #operationProfiling:

    #replication:

    #sharding:

    ## Enterprise-Only Options:

    #auditLog:

    #snmp:
MongoDB Shell Version:
    MongoDB shell version v5.0.3
    Build Info: {
        "version": "5.0.3",
        "gitVersion": "657fea5a61a74d7a79df7aff8e4bcf0bc742b748",
        "modules": [
            "enterprise"
        ],
        "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://sandbox.gfogv.mongodb.net/admin” --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.