Embed to mongodb using asyncio_mongo

I have a situation, I need to add data about mongodb asynchronously, so I used the asyncio-mongodb package to add data.

It's ok if I don't fill in the username / password, but when I fill in the username / password, this error appears:

asyncio_mongo._pymongo.errors.OperationFailure: {'code': 16544, 'ok': 1.0, 'n': 0, 'err': 'not authorized for insert on ty_mongodb_memory1.bi_mongo_driver_pos', 'connectionId': 256286}

      

I added data to this collection in sync mode (username / password is correct).

What is the problem?

+3


source to share


1 answer


Whenever you create your mongo DB connection you need to fill in the "DB" parameter



asyncio_mongo.Connection.create('hostname', 'port', 
                                username="user", 
                                password="password", 
                                db='PUT YOUR DB NAME HERE')

      

+3


source







All Articles