Python Motor vs Pymongo

0
13K

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.

Căutare
Categorii
Citeste mai mult
Жизненные вопросы
Она говорит со мной. We Still Talk. (2021)
Вот уже 65 лет Нино влюблен в Рину и продолжает любить, хотя ее уже нет рядом. Он все еще...
By Nikolai Pokryshkin 2022-09-16 21:59:50 0 25K
Marketing and Advertising
How Is a Marketing Strategy Different from a Marketing Plan or Tactics?
Introduction Marketing is often described as both an art and a science, but one of the most...
By Dacey Rankins 2025-10-15 19:00:51 0 3K
Business
What Are the Key Phases of a Project?
Project management is a structured approach to planning and guiding project processes from start...
By Dacey Rankins 2025-05-15 14:32:54 0 8K
Business
Why Do You Want to Work Here? Understanding a Candidate’s Motivation and Alignment
The question "Why do you want to work here?" is a staple in job interviews. It may sound simple,...
By Dacey Rankins 2025-06-25 12:41:52 0 5K
Social Issues
Full Metal Jacket. (1987)
A pragmatic U.S. Marine observes the dehumanizing effects the Vietnam War has on his fellow...
By Leonard Pokrovski 2023-01-22 22:24:01 0 23K

BigMoney.VIP Powered by Hosting Pokrov