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
Financial Services
5 questions to ask before investing in graduate school
Whether you’re finishing a bachelor’s degree or considering going back to...
By Mark Lorenzo 2023-06-05 20:09:58 0 21K
Научная фантастика и фэнтези
Назад в будущее. Back to the Future. (1985)
Подросток Марти с помощью машины времени, сооружённой его другом-профессором доком Брауном,...
By Nikolai Pokryshkin 2022-11-23 16:35:23 0 29K
Programming
Create AI with Python
If you’re just starting out in the artificial intelligence (AI) world, then Python is a...
By Jesse Thomas 2023-05-01 19:27:14 0 11K
Conditions and Diseases
Understanding Conditions and Diseases: A Comprehensive Guide to Health
The human body is a complex system, and when something goes wrong, it can lead to a variety of...
By Dacey Rankins 2024-11-06 16:57:54 0 10K
Programming
Display Data from Python to HTML
When making a web application, you're probably thinking if displaying data from Python to HTML is...
By Jesse Thomas 2023-01-26 19:18:03 0 13K

BigMoney.VIP Powered by Hosting Pokrov