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
Arts, Culture and Entertainment
The Last Vermeer (2020)
Claes Bang (THE SQUARE) stars as Joseph Piller in this captivating dramatic thriller set just...
By Leonard Pokrovski 2022-09-28 18:54:17 0 32K
Airsoft
How to play airsoft
Everyone is welcome. In this article, we'll figure out how to create a new airsoft team and what...
By FWhoop Xelqua 2023-03-26 19:41:17 0 20K
Business
Do I Need a Business Plan?
When starting a business, one of the first questions you may ask is whether you need a business...
By Dacey Rankins 2025-02-06 15:16:25 0 19K
Жизненные вопросы
Гран Торино. Gran Torino. (2008)
Вышедший на пенсию автомеханик Уолт Ковальски проводит дни, починяя что-то по дому, попивая пиво...
By Nikolai Pokryshkin 2023-03-13 18:57:52 0 29K
Life Issues
Spotless Mind. (2004)
When their relationship turns sour, a couple undergoes a medical procedure to have each other...
By Leonard Pokrovski 2023-01-10 18:05:32 0 21K

BigMoney.VIP Powered by Hosting Pokrov