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.8.tar.gz (8.4 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.8-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mokeidb-0.1.8.tar.gz
Algorithm Hash digest
SHA256 eacaa93ee61c79aa7668b25951269e1ac4e7fcb48338f48f93848482a45ef629
MD5 4e88afad9f94317877558fc35b5d8a46
BLAKE2b-256 d5fe811c2285ceca8478bf3f21bca7fc60b2881c97e2946eb5236564f80d2386

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mokeidb-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a7521df0c8db944b51e9a885195d20f7ce9b42bc97ead8ba971d3f18d340914a
MD5 583437f99a07a7eacc300673c79b56dc
BLAKE2b-256 16596bef1c2e8402968dd1d3fa975ee0c74ba4331ae92d2b78c4cc7756517559

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