Analyze and understand data stored in MongoDB from the command line
Project description
Mongo Analyser is a TUI (text user interface) application that helps users get a sense of the structure of their data in MongoDB. It allows users to extract the schema, metadata, and sample documents from MongoDB collections and chat with an AI assistant to explore and understand their data better.
Why Mongo Analyser?
A NoSQL database like MongoDB makes it much easier to store data without a predefined schema. This flexibility allows developers to quickly experiment with different ideas and adapt the data model as needed, especially during the early stages of development of a project. However, this can lead to the data becoming unorganized, inconsistent, and difficult to manage over time. Mongo Analyser aims to help with this problem by making it easier for users to understand the structure of their MongoDB collections to prevent data from becoming a big mess over time.
Features
- User-friendly TUI with built-in AI assistant
- Supports MongoDB Atlas and self-hosted MongoDB instances
- Compatible with AI models from Ollama, OpenAI, and Google
- Automatic schema inference from MongoDB collections
- Data and metadata extraction from collections
[!Note] Mongo Analyser is still in its early stages of development. For bugs, feature requests, or discussions, please use the GitHub Issues and Discussions pages. Contributions are very welcome! See Contributing Guide for more details.
TUI Screenshots
Show more screenshots
Installation
Install Mongo Analyser using pipx or uv:
pipx install mongo-analyser
uv tool install mongo-analyser
Quick Start
Launch Mongo Analyser by running:
mongo_analyser
Show more advanced usages
You can configure Mongo Analyser with additional options:
Connect with environment variables
export OLLAMA_HOST="http://localhost:11434"
export GOOGLE_API_KEY="your_google_api_key"
export OPENAI_API_KEY="your_openai_api_key"
mongo_analyser --db my_database
Connect via MongoDB URI
export MONGO_PASSWORD="your_secure_password"
mongo_analyser --uri "mongodb://user:${MONGO_PASSWORD}@host:27017/db"
Connect by prompting for password
mongo_analyser --host my_host --port 27017 --username my_user --db my_database
Use mongo_analyser --help for a full list of commands.
Documentation
Show
MongoDB Connection
MONGO_URIMONGO_HOST(default:localhost)MONGO_PORT(default:27017)MONGO_USERNAMEMONGO_DATABASE
AI Providers
OPENAI_API_KEYGOOGLE_API_KEYOLLAMA_HOST(default:http://localhost:11434)OLLAMA_CONTEXT_LENGTH(default:2048)
Misc
MONGO_ANALYSER_HOME_DIR: Path to the Mongo Analyser home directory, where configuration and data files are stored. This can be set to a custom path if you want to change the default location. If not set, it defaults to~/.local/shared/mongo_analyser.
Supported Field Types
Mongo Analyser can infer the schema of a MongoDB collection and show it as a key-value structure in JSON format. The keys are the field names, and the values are the types of the fields. The following table shows the supported field types in Mongo Analyser, their Python equivalents, and their MongoDB equivalents:
| Field Type | Python Equivalent | MongoDB Equivalent | Comments |
|---|---|---|---|
int32 |
int |
int32 |
|
int64 |
int |
int64 |
|
double |
float |
double |
|
str |
str |
string |
|
bool |
bool |
bool |
|
datetime |
datetime |
date |
|
dict |
dict |
document |
Equivalent to a BSON document (which is a MongoDB object or subdocument) |
empty |
None or [] |
null or array |
The empty type is used when a field has no value (null) or is an empty array. |
array<type> |
list |
array |
The type of the elements in the array is inferred from the sample of documents and can be any of the supported types except for array<type> |
binary<UUID> |
bytes |
binary (subtype 4) |
The UUID is stored as a 16-byte binary value |
binary<MD5> |
bytes |
binary (subtype 5) |
The MD5 hash is stored as a 16-byte binary value |
binary<ObjectId> |
bytes |
objectId |
The ObjectId is stored as a 12-byte binary value |
Contributing
Check CONTRIBUTING.md for guidelines on how to contribute to this project.
Logo
Leaf logo courtesy of SVG Repo.
License
Mongo Analyser is available under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mongo_analyser-0.2.1.tar.gz.
File metadata
- Download URL: mongo_analyser-0.2.1.tar.gz
- Upload date:
- Size: 60.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.10 Linux/6.11.0-1014-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0bf982cee10f4b3cca8b075e17b073af29592ae9e86a427c75486fffd9a94c6
|
|
| MD5 |
0989d0bbfe516e8f32f79ff0ed028b7a
|
|
| BLAKE2b-256 |
aaae176356580cd324d5e34faffa080a4a1e6963d35a8bbd8cd9e076f1eefad2
|
File details
Details for the file mongo_analyser-0.2.1-py3-none-any.whl.
File metadata
- Download URL: mongo_analyser-0.2.1-py3-none-any.whl
- Upload date:
- Size: 74.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.10 Linux/6.11.0-1014-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32d2884d5a67ab91501f72c212fdf51c629ff30492b062510bedd3f6b6128b44
|
|
| MD5 |
f348876102b0fdfe31c3a5d8c5bf85e2
|
|
| BLAKE2b-256 |
cba71c85586635fdfbf2f03ef8ff18152a0af8fc079cbe9b8c10228ac6ed96b4
|