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.5.tar.gz (8.0 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.5-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mokeidb-0.1.5.tar.gz
  • Upload date:
  • Size: 8.0 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.5.tar.gz
Algorithm Hash digest
SHA256 334c308d8006a2dabdd6af23e586a6b13d386237e55a715f57cd72b8cc396fc0
MD5 0b927214c880ea075417de43357eb5f7
BLAKE2b-256 e5aac1327f943961ca2aae62888205cf6c1c2ecb89bcbab38e907ff7f02d1421

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mokeidb-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 11.5 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a6d2df2be75346f857d3e9eff86794fd5069bfd58cc9d70065599f8397c02c19
MD5 03f4e27cdf51d9570cdfd16eaf2de479
BLAKE2b-256 790f38fe4f3d212c94a6b5dfc22f92097f2adf2b0efb821413cb9cc7190eed91

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