Python Motor vs Pymongo

0
11Кб

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.

Поиск
Категории
Больше
Biology
The Role of Competition in Natural Selection and Evolution
Competition is a driving force in the natural world, shaping the survival and evolution of...
От Dacey Rankins 2025-01-14 14:46:24 0 9Кб
Pre-School
The Importance of Preschool: Laying the Foundation for Lifelong Learning
Preschool is often seen as the first formal experience for young children before they enter...
От Dacey Rankins 2024-11-27 17:49:03 0 10Кб
Жизненные вопросы
Седьмая Печать. The Seventh Seal. (1957)
В середине XIV века рыцарь Антониус Блок и его оруженосец возвращаются после десяти лет крестовых...
От Nikolai Pokryshkin 2023-04-07 13:20:35 0 27Кб
Business
What are the key components of a crisis management plan?
In today’s fast-paced and often unpredictable world, businesses and organizations need to...
От Dacey Rankins 2025-01-17 16:46:39 0 9Кб
Chemistry
10 interesting facts about chemistry
For many, weekdays are almost monotonous: home, work, home ... And often this drives people into...
От FWhoop Xelqua 2022-11-24 13:54:18 0 27Кб

BigMoney.VIP Powered by Hosting Pokrov