diff --git a/docs/index.rst b/docs/index.rst index f00b214..8e17829 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -114,7 +114,7 @@ constructor. These are passed directly through to the underlying By default, Flask-PyMongo sets the ``connect`` keyword argument to ``False``, to prevent PyMongo from connecting immediately. PyMongo itself `is not fork-safe - `_, + `_, and delaying connection until the app is actually used is necessary to avoid issues. If you wish to change this default behavior, pass ``connect=True`` as a keyword argument to ``PyMongo``. diff --git a/flask_pymongo/__init__.py b/flask_pymongo/__init__.py index 1737505..7be13fb 100644 --- a/flask_pymongo/__init__.py +++ b/flask_pymongo/__init__.py @@ -110,7 +110,7 @@ def init_app(self, app: Flask, uri: str | None = None, *args: Any, **kwargs: Any database_name = parsed_uri["database"] # Try to delay connecting, in case the app is loaded before forking, per - # https://www.mongodb.com/docs/languages/python/pymongo-driver/current/faq/#is-pymongo-fork-safe- + # https://www.mongodb.com/docs/languages/python/pymongo-driver/current/connect/mongoclient/#forking-a-process-causes-a-deadlock kwargs.setdefault("connect", False) if DriverInfo is not None: kwargs.setdefault("driver", DriverInfo("Flask-PyMongo", __version__))