I am making an app using Pymongo (MongoDB). I have managed to work my way around logging the data to a MongoDB database, but I want to be able to specify the exact path where database file would be saved.
The reason why I want this is the fact that another app should be able to select (this is really important) the db file and load it's content. And it needs to be easy to find that specific file.
EDIT: Editing the configuration file of Mongo is not an option for me because this should be possible for the user to specify every time the program is run.
you cant
do that in python.
you must go to mongodb settings
on your machine and tell where to save your databases
pymongo its just a client to communicate with the mongodb
server.
but, you can specify to which database to connect to using pymongo
, like this:
MONGO_URI_db1 = "mongodb://<username>:<password>@localhost:27017/database1"
MONGO_URI_db2 = "mongodb://<username>:<password>@localhost:27017/database2"
to edit the database location for mongodb there is this inspiration to achieve your goal.