mongodb - create mongo connection handler with python -


How to write mongo connection handlers with pongo? I want to ask for a connection to all the modules in my program. I mean use pymongo MongoClient for example and write handler for it.

For example in your application anywhere, such as a __ init __.py and then import that object wherever you want it to be used. Customer enforces connection pooling, so you should be correct without writing any additional handlers.

Example:

  ap / __init__.py db = Mongo client ()   

and then

  App / ModuleApplication DB    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -