Skip to main content

MongoDB Data Layer

A data modeling MongoDB library for Python


Installation

  1. Install the python package via pip:
pip install mongodb-data-layer

Note: It is better to create a python virtual environment...

  1. 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
    
  2. 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
  1. It will generate a file like this:
#A MongoDB model for the tests collection
from mongodb_data_layer.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

Metadata

Release files for mongodb-data-layer 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mongodb-data-layer 1.2
File Size Uploaded
mongodb_data_layer-1.2.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mongodb-data-layer 1.2
File Interpreter ABI Platform
mongodb_data_layer-1.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / mongodb_data_layer-1.2.tar.gz

Download URL mongodb_data_layer-1.2.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b98e3a23631f9f71514006e5573b7c6d1cdc4c47eb415490ccaf60f85c5d0ce4
BLAKE2b-256 checksum
How to use checksums
a971fb36d247da4525d36fd624489d840bcaf9224aff9ab694d6ef89bfeafd2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / mongodb_data_layer-1.2-py3-none-any.whl

Download URL mongodb_data_layer-1.2-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3938d2e3d3a2930950eb7e2ec88ba38168de72f694d887e2628290249567233d
BLAKE2b-256 checksum
How to use checksums
147a45d6447461818bbed832f3ee7a54b3c37db7e52ee1a43f7d2a523c13c05c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1

2 release files

1.0

2 release files

0.9

2 release files

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page