Skip to main content

Create MongoDB models like creating a dataclass

Project description

MokeiDB

MokeiDB is an ORM model for MongoDB.

Write MongoDB models like you would write a dataclass:

@database('MyDatabase')
class Company(MongoDbModel):
    registration_number: int
    name: str
    incorporated: datetime.datetime

You can create complex models by including one model in another:

@database('MyDatabase')
class Employee(MongoDbModel):
    employee_id: int
    company: Company

To retrieve an object from the database:

company = Company.find_one(name='Python Inc.')

To get all objects matching a particular query:

employees = Employee.find(company=company)

To make a change to the company:

company.name = 'Pythonistas Inc.'
company.save()  # writes to database

Or update and write fields in one line:

company.update(name='Snakes Inc.')

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

mokeidb-0.1.7.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

mokeidb-0.1.7-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file mokeidb-0.1.7.tar.gz.

File metadata

  • Download URL: mokeidb-0.1.7.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for mokeidb-0.1.7.tar.gz
Algorithm Hash digest
SHA256 958da81070bfff58d56d0ce5aad0ab24e9b243379c172f0ef6152b913fd40cda
MD5 4decb2b273cb9e73f11def9518bebbea
BLAKE2b-256 abd56590be719a972d6d4d036563eb086144445b5480afe1271c9302d7ed0f92

See more details on using hashes here.

File details

Details for the file mokeidb-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: mokeidb-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for mokeidb-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fc73845820d29716a2cdff8445d894bd7e2ed742243475ccf22210ae8c55cf25
MD5 aabc0555ec2d6361b993a05910cd428c
BLAKE2b-256 0d5a1fbefa0d8d92f1a32c479e9bdfabdf0d6ee1b250c3b1271a6a7a709cb872

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