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.

Cerca
Categorie
Leggi tutto
Social Issues
Thirteen. (2003)
A thirteen-year-old girl's relationship with her mother is put to the test as she discovers...
By Leonard Pokrovski 2023-04-28 19:32:50 0 26K
Business
How Does Page Speed Affect Conversion Rates?
In today’s digital-first world, users expect instant gratification. Whether they’re...
By Dacey Rankins 2025-09-10 15:09:48 0 2K
Financial Services
The expenditure-output, or Keynesian cross, model
Key points The expenditure-output model, or Keynesian cross diagram, shows how the...
By Mark Lorenzo 2023-06-14 20:21:07 0 12K
Financial Services
The structure of costs in the short run
Key points Looked at from a short-run perspective, a firm’s total costs can...
By Mark Lorenzo 2023-04-20 20:21:49 0 11K
Искусство, культура и развлечения
Друзья на свою голову. A Friendly Tale... (2020)
Леа и Марк, Карин и Франсис – две пары закадычных друзей. Но когда скромная тихоня Леа...
By Nikolai Pokryshkin 2022-09-30 20:35:52 0 24K

BigMoney.VIP Powered by Hosting Pokrov