Python Motor vs Pymongo

0
12K

Motor provides a single client class, MotorClient. Unlike PyMongo’s MongoClient, Motor’s client class does not begin connecting in the background when it is instantiated. Instead it connects on demand, when you first attempt an operation.

You should use Motor when you're trying to interact with a MongoDB database in an asynchronous context. When you're making something that needs to be asynchronous (like a web server, or most commonly from what I've seen here, Discord bots), you also want all the database calls to be done asynchronously. But pymongo is synchronous, i.e it is blocking, and will block the execution of your asynchronous program for the time that it is talking to the database.

Search
Categories
Read More
Социальные проблемы
«V» значит Вендетта. V for Vendetta. (2005)
Альтернативное будущее. В Англии после страшной эпидемии неизвестного вируса повергшей страну в...
By Nikolai Pokryshkin 2023-03-02 11:12:13 0 44K
История
Список Шиндлера. Schindler's List. (1993)
Сценарий «Списка Шиндлера» долго кочевал от одного режиссера к другому, пока не...
By Nikolai Pokryshkin 2022-10-31 20:54:26 0 31K
Business
What is entrepreneurship?
Entrepreneurship is the process of identifying opportunities, taking risks, and creating value by...
By Dacey Rankins 2025-03-11 15:38:08 0 6K
Financial Services
How to reduce taxes
It is said that only two things are inevitable in the world - death and taxes. The first really...
By FWhoop Xelqua 2023-05-30 18:55:27 0 24K
Travel
Named the most visited attractions in the world
The authoritative publication Travel + Leisure has published a list of the main tourist...
By FWhoop Xelqua 2023-01-03 14:47:15 0 21K

BigMoney.VIP Powered by Hosting Pokrov