Closed hemangjoshi37a closed 1 year ago
Error while running: python init_db.py
Traceback (most recent call last): File "init_db.py", line 16, in
db = client.get_default_database() File "/home/hemang/anaconda3/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1948, in get_default_database raise ConfigurationError("No default database name defined or provided.") pymongo.errors.ConfigurationError: No default database name defined or provided.
Hello, @hemangjoshi37a! Please, firstly, make sure that you have environmental variables set up according to the build instruction.
The provided error points out that you don't have MONGO_CONN_STRING="mongodb://127.0.0.1:27017/test_db?compressors=zlib"
as an environmental variable.
Then, before running the script, make sure you have started your Mongo database. The following ways are possible:
Windows OS:
cd C:\Program Files\MongoDB\Server\3.2\bin
mongod
Linux
sudo service mongod start
Hope, this helps.
How to set anything as an environment variable?
How to set anything as an environment variable?
This depends on OS that you use.
Windows power shell:
$env:VARNAME = value
Windows cmd:
export varname=value
Linux bash:
$ export VAR="my value"
How to set anything as an environment variable?
This depends on OS that you use.
Windows power shell:
$env:VARNAME = value
Windows cmd:
export varname=value
Linux bash:
$ export VAR="my value"
Thanks for the solution.👍
Error while running:
python init_db.py
https://hjlabs.in