Answer the question
In order to leave comments, you need to log in
Why is pymongo throwing an error?
Understanding how to work with pymongo. Wrote a simple code.
from pymongo import MongoClient
cluster = MongoClient("mongodb+srv://тут мое имя:<мой пароль>@cluster0.7xxw7.mongodb.net/testbase(это имя моей бд)?retryWrites=true&w=majority")
db = cluster["testbase"]
collection = db["users"]
name = input("> ")
collection.insert_one({"_id":1, "name": name, "balance":random.randint(1, 100)})
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: bad auth : Authentication failed., full error: {'ok': 0, 'errmsg': 'bad auth : Authentication failed.', 'code': 8000, 'codeName': 'AtlasError'}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question