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.