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.4.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

mokeidb-0.1.4-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mokeidb-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2c4887c3db147f1d9ba0c96227b4d5dd022715ab440ae579bd118d309915afa3
MD5 9b6fde0622afcfa60fdeb6c42ce1fb4a
BLAKE2b-256 d85c761386794e1de442a0c5cb5ef923dd3dc00ec6e056a23716fbff93c9f8e3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mokeidb-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 97e2d4c086665e4c80a52bd960f0c969203125d89639215d5607c811c990b176
MD5 74c7b7e9b262f894c06c94910bb9d7c5
BLAKE2b-256 e2a7cfdccb232d76062578aeedaa47c4edd43b427ca9bb25e75473d68f06a354

See more details on using hashes here.

Supported by

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