Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
<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>`_,
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``.
Expand Down
2 changes: 1 addition & 1 deletion flask_pymongo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))
Expand Down