pymongo.MongoClient is actually an alias for pymongo.mongo_client.MongoClient. This class accepts a URI style connection string as an argument or individual parameters, as shown here. The arguments in square brackets [] are optional:
from pymongo.mongo_client import MongoClient
client = MongoClient(<host>[,<port>,<document_class>,<tz_aware>,<connect>,**kwargs])
The main parameters are summarized in this table:
Parameter | Notes |
host | Can be localhost, a DNS address (for example, db.unlikelysource.com), or an IP address. |
port | If not specified, defaults to 27017; otherwise, specify the MongoDB listening port. |
document_class | Defaults to dict. This parameter controls what gets returned when you run a database query. This parameter ties the entity classes discussed in the previous chapter into MongoDB. |
tz_aware | If set to True, any datetime instances reflect the server's time zone. |
connect | If set to True, it causes the client... |