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

Uploaded Source

Built Distribution

mokeidb-0.1.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mokeidb-0.1.3.tar.gz
  • Upload date:
  • Size: 7.6 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.3.tar.gz
Algorithm Hash digest
SHA256 4f93a98fd6c3009d1ba3da480c31be490dd176afe04387c1b00caf6eaa136b35
MD5 c880e537d9e43ce4bc398986e9914dd6
BLAKE2b-256 044712013ca7bc711a8dfc9dd92bd166670a2e1c5cdac20172a4115d9912c959

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mokeidb-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 684fddf8deb7cd86329c66b94576ba38fcf19fd0c71a6ec97a9a0d1ad78a219f
MD5 f6b4b07c0e1f4899e2a2f6b12b72ea35
BLAKE2b-256 7ed4450c929d5a108165efadccc1f1a792a1acf6d8c38dfde33a3bd3827c82f6

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