Where is mongo database folder on the filesystem











up vote
4
down vote

favorite
1












I'm using Ubuntu 16.04. I have set up a database MongoDB. When I start it (with mongod command) it says that database is located at /data/db (dbpath=/data/db).



The database works fine. But in files explorer I cannot find that folder. I've looked in Computer folder and in Home (Computer/home/<my name>) folder.



I also showed hidden files and folders with Ctrl+H.



How can I find my database folder?










share|improve this question




























    up vote
    4
    down vote

    favorite
    1












    I'm using Ubuntu 16.04. I have set up a database MongoDB. When I start it (with mongod command) it says that database is located at /data/db (dbpath=/data/db).



    The database works fine. But in files explorer I cannot find that folder. I've looked in Computer folder and in Home (Computer/home/<my name>) folder.



    I also showed hidden files and folders with Ctrl+H.



    How can I find my database folder?










    share|improve this question


























      up vote
      4
      down vote

      favorite
      1









      up vote
      4
      down vote

      favorite
      1






      1





      I'm using Ubuntu 16.04. I have set up a database MongoDB. When I start it (with mongod command) it says that database is located at /data/db (dbpath=/data/db).



      The database works fine. But in files explorer I cannot find that folder. I've looked in Computer folder and in Home (Computer/home/<my name>) folder.



      I also showed hidden files and folders with Ctrl+H.



      How can I find my database folder?










      share|improve this question















      I'm using Ubuntu 16.04. I have set up a database MongoDB. When I start it (with mongod command) it says that database is located at /data/db (dbpath=/data/db).



      The database works fine. But in files explorer I cannot find that folder. I've looked in Computer folder and in Home (Computer/home/<my name>) folder.



      I also showed hidden files and folders with Ctrl+H.



      How can I find my database folder?







      16.04 files filesystem database mongodb






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 3 '17 at 8:35









      Yaron

      8,74871939




      8,74871939










      asked Dec 3 '17 at 7:52









      croraf

      123114




      123114






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          3
          down vote













          You should be able to find the location in the configuration file: /etc/mongod.conf



          grep dbPath /etc/mongod.conf




          According to mongodb docs:



          The default path is /data/db directory




          By default, MongoDB listens for connections from clients on port
          27017, and stores data in the /data/db directory.




          If dbPath is set, the mongodb will use the directory specify by dbPath




          If you want mongod to store data files at a path other than /data/db
          you can specify a dbPath. The dbPath must exist before you start
          mongod. If it does not exist, create the directory and the permissions
          so that mongod can read and write data to this path. For more
          information on permissions, see the security operations documentation.







          share|improve this answer























          • I found /etc/mongod.conf (notice there is no 'b' letter). There it says: storage: dbPath: /var/lib/mongodb. And that folder looks like it could be the database. Also the variable is dbPath (uppercase 'P'). But then why the hell when I start mongod it says dbpath=/data/db?
            – croraf
            Dec 3 '17 at 8:00












          • @croraf - the /data/db is the default value of the path, if dbPath is set, it override this value. Note that in order to use /data/db as actual path, the folder should be exists and have the correct ownership/permissions. see updated answer with link to mongodb docs
            – Yaron
            Dec 3 '17 at 8:34










          • Thanks! The issue is mongod command outputs "MongoDB starting : pid=2722 port=27017 dbpath=/data/db 64-bit host=korisnik-Lenovo-Y520-15IKBN" indicating that dbpath is /data/db. Although this could be the default path the db starting command should indicate the actual path, in my case /var/lib/mongodb.
            – croraf
            Dec 3 '17 at 8:38








          • 1




            @croraf /etc/mongod.conf configuration is only used if you Start MongoDB as a service or explicitly pass this on the command line: mongod --config /etc/mongod.conf. If you start mongod without any options the default of /data/db will be used. If you start mongod as a service on Ubuntu, dbPath will be as specified in /etc/mongod.conf (/var/lib/mongodb by default). Typically you want to be managing MongoDB as a service to ensure consistent configuration is used between invocations.
            – Stennie
            Dec 4 '17 at 3:19










          • @Stennie Yes it seems mongod is started on OS boot (what you call 'as a service'). This was confusing me. I will check today but probably running mongod gives error that the port is already bound.
            – croraf
            Dec 4 '17 at 9:20




















          up vote
          0
          down vote













          That's because the "root" that you are seeing, is not the real root, its the root of your home, on the File explorer, when you are on your 'root' home page, press backspace to go to the parent folder.






          share|improve this answer




























            up vote
            -1
            down vote













            Try typing file:///data/db/ in the browser (chrome or fire-fox). You'll be able to see the files and collections if you have mongodb installed in system, but all would be encrypted you cannot read them in an editor.






            share|improve this answer























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f982673%2fwhere-is-mongo-database-folder-on-the-filesystem%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              3
              down vote













              You should be able to find the location in the configuration file: /etc/mongod.conf



              grep dbPath /etc/mongod.conf




              According to mongodb docs:



              The default path is /data/db directory




              By default, MongoDB listens for connections from clients on port
              27017, and stores data in the /data/db directory.




              If dbPath is set, the mongodb will use the directory specify by dbPath




              If you want mongod to store data files at a path other than /data/db
              you can specify a dbPath. The dbPath must exist before you start
              mongod. If it does not exist, create the directory and the permissions
              so that mongod can read and write data to this path. For more
              information on permissions, see the security operations documentation.







              share|improve this answer























              • I found /etc/mongod.conf (notice there is no 'b' letter). There it says: storage: dbPath: /var/lib/mongodb. And that folder looks like it could be the database. Also the variable is dbPath (uppercase 'P'). But then why the hell when I start mongod it says dbpath=/data/db?
                – croraf
                Dec 3 '17 at 8:00












              • @croraf - the /data/db is the default value of the path, if dbPath is set, it override this value. Note that in order to use /data/db as actual path, the folder should be exists and have the correct ownership/permissions. see updated answer with link to mongodb docs
                – Yaron
                Dec 3 '17 at 8:34










              • Thanks! The issue is mongod command outputs "MongoDB starting : pid=2722 port=27017 dbpath=/data/db 64-bit host=korisnik-Lenovo-Y520-15IKBN" indicating that dbpath is /data/db. Although this could be the default path the db starting command should indicate the actual path, in my case /var/lib/mongodb.
                – croraf
                Dec 3 '17 at 8:38








              • 1




                @croraf /etc/mongod.conf configuration is only used if you Start MongoDB as a service or explicitly pass this on the command line: mongod --config /etc/mongod.conf. If you start mongod without any options the default of /data/db will be used. If you start mongod as a service on Ubuntu, dbPath will be as specified in /etc/mongod.conf (/var/lib/mongodb by default). Typically you want to be managing MongoDB as a service to ensure consistent configuration is used between invocations.
                – Stennie
                Dec 4 '17 at 3:19










              • @Stennie Yes it seems mongod is started on OS boot (what you call 'as a service'). This was confusing me. I will check today but probably running mongod gives error that the port is already bound.
                – croraf
                Dec 4 '17 at 9:20

















              up vote
              3
              down vote













              You should be able to find the location in the configuration file: /etc/mongod.conf



              grep dbPath /etc/mongod.conf




              According to mongodb docs:



              The default path is /data/db directory




              By default, MongoDB listens for connections from clients on port
              27017, and stores data in the /data/db directory.




              If dbPath is set, the mongodb will use the directory specify by dbPath




              If you want mongod to store data files at a path other than /data/db
              you can specify a dbPath. The dbPath must exist before you start
              mongod. If it does not exist, create the directory and the permissions
              so that mongod can read and write data to this path. For more
              information on permissions, see the security operations documentation.







              share|improve this answer























              • I found /etc/mongod.conf (notice there is no 'b' letter). There it says: storage: dbPath: /var/lib/mongodb. And that folder looks like it could be the database. Also the variable is dbPath (uppercase 'P'). But then why the hell when I start mongod it says dbpath=/data/db?
                – croraf
                Dec 3 '17 at 8:00












              • @croraf - the /data/db is the default value of the path, if dbPath is set, it override this value. Note that in order to use /data/db as actual path, the folder should be exists and have the correct ownership/permissions. see updated answer with link to mongodb docs
                – Yaron
                Dec 3 '17 at 8:34










              • Thanks! The issue is mongod command outputs "MongoDB starting : pid=2722 port=27017 dbpath=/data/db 64-bit host=korisnik-Lenovo-Y520-15IKBN" indicating that dbpath is /data/db. Although this could be the default path the db starting command should indicate the actual path, in my case /var/lib/mongodb.
                – croraf
                Dec 3 '17 at 8:38








              • 1




                @croraf /etc/mongod.conf configuration is only used if you Start MongoDB as a service or explicitly pass this on the command line: mongod --config /etc/mongod.conf. If you start mongod without any options the default of /data/db will be used. If you start mongod as a service on Ubuntu, dbPath will be as specified in /etc/mongod.conf (/var/lib/mongodb by default). Typically you want to be managing MongoDB as a service to ensure consistent configuration is used between invocations.
                – Stennie
                Dec 4 '17 at 3:19










              • @Stennie Yes it seems mongod is started on OS boot (what you call 'as a service'). This was confusing me. I will check today but probably running mongod gives error that the port is already bound.
                – croraf
                Dec 4 '17 at 9:20















              up vote
              3
              down vote










              up vote
              3
              down vote









              You should be able to find the location in the configuration file: /etc/mongod.conf



              grep dbPath /etc/mongod.conf




              According to mongodb docs:



              The default path is /data/db directory




              By default, MongoDB listens for connections from clients on port
              27017, and stores data in the /data/db directory.




              If dbPath is set, the mongodb will use the directory specify by dbPath




              If you want mongod to store data files at a path other than /data/db
              you can specify a dbPath. The dbPath must exist before you start
              mongod. If it does not exist, create the directory and the permissions
              so that mongod can read and write data to this path. For more
              information on permissions, see the security operations documentation.







              share|improve this answer














              You should be able to find the location in the configuration file: /etc/mongod.conf



              grep dbPath /etc/mongod.conf




              According to mongodb docs:



              The default path is /data/db directory




              By default, MongoDB listens for connections from clients on port
              27017, and stores data in the /data/db directory.




              If dbPath is set, the mongodb will use the directory specify by dbPath




              If you want mongod to store data files at a path other than /data/db
              you can specify a dbPath. The dbPath must exist before you start
              mongod. If it does not exist, create the directory and the permissions
              so that mongod can read and write data to this path. For more
              information on permissions, see the security operations documentation.








              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Dec 3 '17 at 8:32

























              answered Dec 3 '17 at 7:56









              Yaron

              8,74871939




              8,74871939












              • I found /etc/mongod.conf (notice there is no 'b' letter). There it says: storage: dbPath: /var/lib/mongodb. And that folder looks like it could be the database. Also the variable is dbPath (uppercase 'P'). But then why the hell when I start mongod it says dbpath=/data/db?
                – croraf
                Dec 3 '17 at 8:00












              • @croraf - the /data/db is the default value of the path, if dbPath is set, it override this value. Note that in order to use /data/db as actual path, the folder should be exists and have the correct ownership/permissions. see updated answer with link to mongodb docs
                – Yaron
                Dec 3 '17 at 8:34










              • Thanks! The issue is mongod command outputs "MongoDB starting : pid=2722 port=27017 dbpath=/data/db 64-bit host=korisnik-Lenovo-Y520-15IKBN" indicating that dbpath is /data/db. Although this could be the default path the db starting command should indicate the actual path, in my case /var/lib/mongodb.
                – croraf
                Dec 3 '17 at 8:38








              • 1




                @croraf /etc/mongod.conf configuration is only used if you Start MongoDB as a service or explicitly pass this on the command line: mongod --config /etc/mongod.conf. If you start mongod without any options the default of /data/db will be used. If you start mongod as a service on Ubuntu, dbPath will be as specified in /etc/mongod.conf (/var/lib/mongodb by default). Typically you want to be managing MongoDB as a service to ensure consistent configuration is used between invocations.
                – Stennie
                Dec 4 '17 at 3:19










              • @Stennie Yes it seems mongod is started on OS boot (what you call 'as a service'). This was confusing me. I will check today but probably running mongod gives error that the port is already bound.
                – croraf
                Dec 4 '17 at 9:20




















              • I found /etc/mongod.conf (notice there is no 'b' letter). There it says: storage: dbPath: /var/lib/mongodb. And that folder looks like it could be the database. Also the variable is dbPath (uppercase 'P'). But then why the hell when I start mongod it says dbpath=/data/db?
                – croraf
                Dec 3 '17 at 8:00












              • @croraf - the /data/db is the default value of the path, if dbPath is set, it override this value. Note that in order to use /data/db as actual path, the folder should be exists and have the correct ownership/permissions. see updated answer with link to mongodb docs
                – Yaron
                Dec 3 '17 at 8:34










              • Thanks! The issue is mongod command outputs "MongoDB starting : pid=2722 port=27017 dbpath=/data/db 64-bit host=korisnik-Lenovo-Y520-15IKBN" indicating that dbpath is /data/db. Although this could be the default path the db starting command should indicate the actual path, in my case /var/lib/mongodb.
                – croraf
                Dec 3 '17 at 8:38








              • 1




                @croraf /etc/mongod.conf configuration is only used if you Start MongoDB as a service or explicitly pass this on the command line: mongod --config /etc/mongod.conf. If you start mongod without any options the default of /data/db will be used. If you start mongod as a service on Ubuntu, dbPath will be as specified in /etc/mongod.conf (/var/lib/mongodb by default). Typically you want to be managing MongoDB as a service to ensure consistent configuration is used between invocations.
                – Stennie
                Dec 4 '17 at 3:19










              • @Stennie Yes it seems mongod is started on OS boot (what you call 'as a service'). This was confusing me. I will check today but probably running mongod gives error that the port is already bound.
                – croraf
                Dec 4 '17 at 9:20


















              I found /etc/mongod.conf (notice there is no 'b' letter). There it says: storage: dbPath: /var/lib/mongodb. And that folder looks like it could be the database. Also the variable is dbPath (uppercase 'P'). But then why the hell when I start mongod it says dbpath=/data/db?
              – croraf
              Dec 3 '17 at 8:00






              I found /etc/mongod.conf (notice there is no 'b' letter). There it says: storage: dbPath: /var/lib/mongodb. And that folder looks like it could be the database. Also the variable is dbPath (uppercase 'P'). But then why the hell when I start mongod it says dbpath=/data/db?
              – croraf
              Dec 3 '17 at 8:00














              @croraf - the /data/db is the default value of the path, if dbPath is set, it override this value. Note that in order to use /data/db as actual path, the folder should be exists and have the correct ownership/permissions. see updated answer with link to mongodb docs
              – Yaron
              Dec 3 '17 at 8:34




              @croraf - the /data/db is the default value of the path, if dbPath is set, it override this value. Note that in order to use /data/db as actual path, the folder should be exists and have the correct ownership/permissions. see updated answer with link to mongodb docs
              – Yaron
              Dec 3 '17 at 8:34












              Thanks! The issue is mongod command outputs "MongoDB starting : pid=2722 port=27017 dbpath=/data/db 64-bit host=korisnik-Lenovo-Y520-15IKBN" indicating that dbpath is /data/db. Although this could be the default path the db starting command should indicate the actual path, in my case /var/lib/mongodb.
              – croraf
              Dec 3 '17 at 8:38






              Thanks! The issue is mongod command outputs "MongoDB starting : pid=2722 port=27017 dbpath=/data/db 64-bit host=korisnik-Lenovo-Y520-15IKBN" indicating that dbpath is /data/db. Although this could be the default path the db starting command should indicate the actual path, in my case /var/lib/mongodb.
              – croraf
              Dec 3 '17 at 8:38






              1




              1




              @croraf /etc/mongod.conf configuration is only used if you Start MongoDB as a service or explicitly pass this on the command line: mongod --config /etc/mongod.conf. If you start mongod without any options the default of /data/db will be used. If you start mongod as a service on Ubuntu, dbPath will be as specified in /etc/mongod.conf (/var/lib/mongodb by default). Typically you want to be managing MongoDB as a service to ensure consistent configuration is used between invocations.
              – Stennie
              Dec 4 '17 at 3:19




              @croraf /etc/mongod.conf configuration is only used if you Start MongoDB as a service or explicitly pass this on the command line: mongod --config /etc/mongod.conf. If you start mongod without any options the default of /data/db will be used. If you start mongod as a service on Ubuntu, dbPath will be as specified in /etc/mongod.conf (/var/lib/mongodb by default). Typically you want to be managing MongoDB as a service to ensure consistent configuration is used between invocations.
              – Stennie
              Dec 4 '17 at 3:19












              @Stennie Yes it seems mongod is started on OS boot (what you call 'as a service'). This was confusing me. I will check today but probably running mongod gives error that the port is already bound.
              – croraf
              Dec 4 '17 at 9:20






              @Stennie Yes it seems mongod is started on OS boot (what you call 'as a service'). This was confusing me. I will check today but probably running mongod gives error that the port is already bound.
              – croraf
              Dec 4 '17 at 9:20














              up vote
              0
              down vote













              That's because the "root" that you are seeing, is not the real root, its the root of your home, on the File explorer, when you are on your 'root' home page, press backspace to go to the parent folder.






              share|improve this answer

























                up vote
                0
                down vote













                That's because the "root" that you are seeing, is not the real root, its the root of your home, on the File explorer, when you are on your 'root' home page, press backspace to go to the parent folder.






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  That's because the "root" that you are seeing, is not the real root, its the root of your home, on the File explorer, when you are on your 'root' home page, press backspace to go to the parent folder.






                  share|improve this answer












                  That's because the "root" that you are seeing, is not the real root, its the root of your home, on the File explorer, when you are on your 'root' home page, press backspace to go to the parent folder.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 28 at 16:30









                  Carlos Villalta

                  11




                  11






















                      up vote
                      -1
                      down vote













                      Try typing file:///data/db/ in the browser (chrome or fire-fox). You'll be able to see the files and collections if you have mongodb installed in system, but all would be encrypted you cannot read them in an editor.






                      share|improve this answer



























                        up vote
                        -1
                        down vote













                        Try typing file:///data/db/ in the browser (chrome or fire-fox). You'll be able to see the files and collections if you have mongodb installed in system, but all would be encrypted you cannot read them in an editor.






                        share|improve this answer

























                          up vote
                          -1
                          down vote










                          up vote
                          -1
                          down vote









                          Try typing file:///data/db/ in the browser (chrome or fire-fox). You'll be able to see the files and collections if you have mongodb installed in system, but all would be encrypted you cannot read them in an editor.






                          share|improve this answer














                          Try typing file:///data/db/ in the browser (chrome or fire-fox). You'll be able to see the files and collections if you have mongodb installed in system, but all would be encrypted you cannot read them in an editor.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Sep 24 at 19:24









                          abu_bua

                          3,10081023




                          3,10081023










                          answered Sep 24 at 18:48









                          Deepu Rohilla

                          1




                          1






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f982673%2fwhere-is-mongo-database-folder-on-the-filesystem%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                              Mangá

                               ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕