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.6.tar.gz (8.2 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.6-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mokeidb-0.1.6.tar.gz
  • Upload date:
  • Size: 8.2 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.6.tar.gz
Algorithm Hash digest
SHA256 9d239282e607a6e350001376fc58cf96a407f095bf232dbc5fe112d4b441686e
MD5 a3fa1b3127775fb46103cafec16f6e44
BLAKE2b-256 0f5da6a721cb32ecafc5f676af66a03b6e885fc9795f8d46e845ccdf48c7adac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mokeidb-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 11.7 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1960fe14946c3a6ea0fbc092484b4a854382a9e14a047bb00b323fe4e3a3a2e6
MD5 1ddbfd7b20eaaac3310bc2c2d5e5a81a
BLAKE2b-256 928049fa4f88b864002ab457d1a442866e078005d05577948fde0cb83ebc27ad

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