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.2.tar.gz
(7.6 kB
view details)
Built Distribution
mokeidb-0.1.2-py3-none-any.whl
(11.1 kB
view details)
File details
Details for the file mokeidb-0.1.2.tar.gz
.
File metadata
- Download URL: mokeidb-0.1.2.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b8db7aca7c38b7576a7410feeef2d93105cc80dfaad89a8f2985cdac1426a4d |
|
MD5 | 90058e87afbcc3f51830c25b5d3a9045 |
|
BLAKE2b-256 | 9f4f4115c578dbcdd0a93551df4effd164e70c1f09b246f22ab3e6e0f59f7498 |
File details
Details for the file mokeidb-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: mokeidb-0.1.2-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e6d6d9aa0965ce11c972fa5f9daba32b7f619c3662791fb5d700a63a52fabca |
|
MD5 | 9005aeb40414f3131fe291570cc4355f |
|
BLAKE2b-256 | 6202d456a9cc33a2982ca3f05ddcfe74cea5d8c32900913db3f0cd3086fc3b95 |