A data mapper for mongodb (Formerly mongodb_data_layer)
Project description
MongoDB Data Layer
A data modeling MongoDB library for Python
Installation
- Install the python package via pip:
pip install mdb-models
Note: It is better to create a python virtual environment...
-
Setup an environment variables:
- To create an environment variables, simply create a file named ".env".
- Then, add these following variables to a created file:
MONGO_DB_URL="mongodb://localhost:27020" # The default mongodb localhost but you can also put a connection string from atlas server. MONGO_DB_NAME="my_database" # Your created database
-
To create a model you can simply enter this command on a command promt:
generate-model /models/test_model.py # where '/models/test_model.py' is your file path and file name
- It will generate a file like this:
#A MongoDB model for the tests collection
from mdb_models.base import BaseMongoModel
class Test(BaseMongoModel):
collection_name = 'tests' # Create a collection with this name in the database
Notes
This library is very useful to lessen the configuration for mongodb database.
This package is build on top of MongoDB official package/drivers.
This is also works well in fastapi.
This library is currently in development. Feel free to contribute.
Official repository: https://github.com/nojram00/mongodb-data-layer
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 mdb_models-2.9.1.tar.gz.
File metadata
- Download URL: mdb_models-2.9.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5928d70ec14448a69e2e445bb067b31adfa338ecb74c465a023c18c6df15713
|
|
| MD5 |
acccd73123f4bace6fdbbcb1bbc46bd3
|
|
| BLAKE2b-256 |
4d3f67662f94f55a67443d8373d90ea13d8f53e2999a824a7abf138b2dc2cc6f
|
File details
Details for the file mdb_models-2.9.1-py3-none-any.whl.
File metadata
- Download URL: mdb_models-2.9.1-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bcbdc52a56d221838f1368853fe3846868b3a63de8c6d50ef45598da4847acf
|
|
| MD5 |
40ae37f92083de3a93d0c94bf15da938
|
|
| BLAKE2b-256 |
c5bed6782ea660e88151b8cf3f1eba23ff05f8e44ab9e4b43d4e77d01994a31b
|