--- id: flask-pymongo version: "3.0.1" license: Copyright (c) 2011-2017, Dan Crosta All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:… (full text in the JSON record) license_treatment: permissive maintenance: active --- # Flask-PyMongo — PyMongo support for Flask applications License: permissive · Maintenance: active · Downloads: 228.0K/mo ## 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 above — verify before relying. Flask-PyMongo integrates MongoDB database access into Flask applications through PyMongo, providing a configured connection object for querying and managing MongoDB collections. 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 pip install flask-pymongo uv add flask-pymongo poetry add flask-pymongo ## Installing Flask-PyMongo 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. 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}) Requires a running MongoDB instance accessible at the URI specified in MONGO_URI config. 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: Copyright (c) 2011-2017, Dan Crosta All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 228.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags flask mongodb integration, pymongo flask extension, mongodb flask orm, flask database adapter, mongo db connection flask, flask pymongo driver, mongodb flask support, flask-extension, mongodb-driver, database-integration [View on SkillFed](https://skillfed.io/packages/flask-pymongo) · [View on PyPI](https://pypi.org/project/flask-pymongo/)