Skip to main content

A data layer for mongodb

Project description

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.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mongodb_data_layer-1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mongodb_data_layer-1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file mongodb_data_layer-1.0.tar.gz.

File metadata

  • Download URL: mongodb_data_layer-1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for mongodb_data_layer-1.0.tar.gz
Algorithm Hash digest
SHA256 bc1d9d9b2bb4ddda2f69f5f22a614b55249e14fe71e18e39113c0d48c2715ea3
MD5 51441e5cb64f12f3b058934207afd338
BLAKE2b-256 3b1a59e336ac6eaad60dde318f70ced0f3cdd5515a033437781672274b58988e

See more details on using hashes here.

File details

Details for the file mongodb_data_layer-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mongodb_data_layer-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d88c6f5d4ba2132d8799b072e0406d46d1827a6e3f47ab6cc79d4994e9a40ca4
MD5 4ae4671f126d4d842d112ab5c9cbf2e7
BLAKE2b-256 4538a31f4e3c0eba16cabad2a1315457cdfe123d658d5e1d76e6846ae1850d37

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page