New to MongoDB Can not run command mongo



  • 3 Answer(s)

    For that your log output states it correct

    exception in initAndListen: 10296 dbpath (/data/db) does not exist, terminating
    
    

    Just you create this directory or better to define it as a configuration value within your configuration file then use it as mongod -f C:\path\to\your\mongodb.conf.

    Answered on January 11, 2019.
    Add Comment

    You should manually create a data folder for after installing the MongoDB.

    By default MongoDB will store data in /data/db,
    but it won't automatically create that directory. To create it, do:
    $ sudo mkdir -p /data/db/
    $ sudo chown `id -u` /data/db
    You can also tell MongoDB to use a different data directory,
    with the --dbpath option.
    

    For further information go to MongoDB wiki page.

     

    Answered on January 11, 2019.
    Add Comment

    To specify the database path similar so, and then to see that solve the issues

    mongod --dbpath data/db
    
    
    Answered on January 11, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.