I'm trying to connect to mongodb using python and code:
myclient = pymongo.MongoClient("mongodb://root:password@mongo:27017/database_sample?authSource=admin")
db = myclient.database_sample
my_collection = db["database"]
but I'm getting
pymongo.errors.OperationFailure: Authentication failed., full error: {'ok': 0.0, 'errmsg': 'Authentication failed.', 'code': 18, 'codeName': 'AuthenticationFailed'}