seims.preprocess.db_mongodb.ConnectMongoDB Class Reference

Inherits object.

Public Member Functions

def __init__ (self, ip, port, maxPoolSize=None)
 
def get_conn (self)
 
def close (self)
 

Detailed Description

Connect to MongoDB, and close when finished.

Constructor & Destructor Documentation

◆ __init__()

def seims.preprocess.db_mongodb.ConnectMongoDB.__init__ (   self,
  ip,
  port,
  maxPoolSize = None 
)
initial mongodb client by hostname and port.

Starting with version 3.0 the MongoClient constructor no longer blocks while connecting to
 the server or servers, and it no longer raises ConnectionFailure if they are unavailable,
 nor ConfigurationError if the user's credentials are wrong.
 Instead, the constructor returns immediately and launches the connection process on
  background threads.
--https://api.mongodb.com/python/current/api/pymongo/mongo_client.html

Member Function Documentation

◆ close()

def seims.preprocess.db_mongodb.ConnectMongoDB.close (   self)
Close collection.

Create this client once for each process, and reuse it for all operations.
It is a common mistake to create a new client for each request, which is very inefficient.
--https://stackoverflow.com/questions/41015490/how-can-i-force-pymongo-to-close-sockets

So, for now, I will comment the close operation. By lj.

◆ get_conn()

def seims.preprocess.db_mongodb.ConnectMongoDB.get_conn (   self)
get MongoDB connection.

The documentation for this class was generated from the following file: