Flask-PyMongo
PyMongo support for Flask applications
Decision gist · record as of 2026-08-14
Yes. Flask-PyMongo is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive BSD license. Install it if you are building a Flask application that needs MongoDB support and prefer a lightweight, direct integration over an ORM. If you need async support, consider Motor instead.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a running MongoDB instance accessible at the URI specified in MONGO_URI config.
- Low install friction with a pure-Python wheel.
- Maintenance is active with a recent commit on 2026-08-12 and steady releases; the project has 721 stars and requires flask>=3.0 and pymongo>=4.0.
License · maintenance · safety
permissive license (permissive) — BSD License (permissive). You may use, modify, and distribute this package freely in commercial and private projects, provided you retain the copyright notice and disclaimer.
last release 2025-01-29 (562 days) · last repo commit 2026-08-12 · 721 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 228,000 downloads/mo, #9,159 on PyPI
Alternatives
Verify before relying
pip install Flask-PyMongo
from flask import Flask
from flask_pymongo import PyMongo
app = Flask(__name__)
app.config["MONGO_URI"] = "mongodb://localhost:27017/myDatabase"
mongo = PyMongo(app)
users = mongo.db.users.find({"online": True})- Whether connection pooling and timeout behavior are configurable beyond the MONGO_URI.
- Support for MongoDB Atlas or other cloud-hosted instances beyond local connections.
- Async/await support or whether it is synchronous-only.
What it is and what it does
Flask-PyMongo is a Flask extension that wraps PyMongo to simplify MongoDB integration in Flask applications. It initializes a PyMongo instance configured through Flask's app.config, exposing the MongoDB connection and database objects as attributes of the extension object. You configure it with a MONGO_URI connection string and then access collections and perform queries directly through the mongo object in your route handlers and application code.
The package is designed for synchronous Flask applications that need straightforward MongoDB access without additional abstraction layers. It requires Flask 3.0 or later and PyMongo 4.0 or later, and supports Python 3.9 through 3.13 on CPython and PyPy. The extension handles connection lifecycle management within Flask's application context.
Use it for
- Building Flask web applications that store and retrieve user data, posts, or other documents in MongoDB.
- Querying MongoDB collections directly in Flask route handlers to render dynamic HTML templates.
- Managing MongoDB connections across multiple Flask blueprints and request handlers.
- Prototyping or developing small-to-medium Flask applications with document-oriented data models.
- Integrating MongoDB into existing Flask projects that previously used SQL databases.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Flask-PyMongo is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive BSD license. Install it if you are building a Flask application that needs MongoDB support and prefer a lightweight, direct integration over an ORM. If you need async support, consider Motor instead.
Install
flask-pymongo on PyPI
Before you install
Low install friction with a pure-Python wheel. Maintenance is active with a recent commit on 2026-08-12 and steady releases; the project has 721 stars and requires flask>=3.0 and pymongo>=4.0.
Requires a running MongoDB instance accessible at the URI specified in MONGO_URI config.
License in practice
BSD License (permissive). You may use, modify, and distribute this package freely in commercial and private projects, provided you retain the copyright notice and disclaimer.
Quickstart
pip install Flask-PyMongo
from flask import Flask
from flask_pymongo import PyMongo
app = Flask(__name__)
app.config["MONGO_URI"] = "mongodb://localhost:27017/myDatabase"
mongo = PyMongo(app)
users = mongo.db.users.find({"online": True})
Verify before relying
- Whether connection pooling and timeout behavior are configurable beyond the MONGO_URI.
- Support for MongoDB Atlas or other cloud-hosted instances beyond local connections.
- Async/await support or whether it is synchronous-only.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesflaskpymongo |
| Maintenance | Actively maintained 562 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 228,000 / month, #9,159 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: Web EnvironmentFramework :: FlaskIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Libraries :: Python Modules |
Evidence: flask_pymongo-3.0.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “flask mongodb integration”
- Flask-PyMongoFlask-PyMongo integrates MongoDB database access into Flask…
- flask-mongoengineFlask-MongoEngine integrates MongoEngine document models with Flask,…
- Flask-SessionFlask-Session adds server-side session storage to Flask applications,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also pymongo · pymongoexplain · djongo · flask-mongoengine · pymongoarrow · pymongo_inmemory · pymongo-auth-aws · pydantic-mongo · pymongo-search-utils · pymongocrypt