Closed undercertainty closed 3 years ago
In Docker container, the Mongo server runs on the default port:
from pymongo import MongoClient
# Open a connection to the Mongo server, open the accidents database and name the collections of accidents and labels
MONGO_PORT = 27017
MONGO_CONNECTION_STRING = f'mongodb://localhost:{MONGO_PORT}/'
client = MongoClient(MONGO_CONNECTION_STRING)
# Create a test database
db = client.testdb
The connection is set up with:
Then we try:
and get the error: