I'm building a simple test web application that stores info users enter in a mongo database.
No errors come up, but I always get the following warning (Im using django) when using the client.
/home/<User>/.local/share/virtualenvs/<Name>/lib/python3.7/site-packages/pymongo/topology.py:155: UserWarning: MongoClient opened before fork. Create MongoClient only after forking. See PyMongo's documentation for details: http://api.mongodb.org/python/current/faq.html#is-pymongo-fork-safe
"MongoClient opened before fork. Create MongoClient only "
After checking out the API docs, it seems that the warning pops up when using fork()
which im not explicitly using.
Maybe something that I'm doing is actually triggering the fork.
I create my mongo client at __init__
and then import the variable to my mongoDB handler. Then, that client that I imported is used inserting or updating items in the DB.
What is the correct way of creating and then using a mongo client to prevent this warning from appearing?