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.1.tar.gz
(7.6 kB
view details)
Built Distribution
mokeidb-0.1.1-py3-none-any.whl
(11.0 kB
view details)
File details
Details for the file mokeidb-0.1.1.tar.gz
.
File metadata
- Download URL: mokeidb-0.1.1.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 | 387e443efccd09940a3421fdc66983be7694c13e539b93a1d1c8f19fe4b9fc32 |
|
MD5 | 3b40925b2773d72cc12507d8f6e36a4e |
|
BLAKE2b-256 | 7c64489f3e43d25c5532fe94caecf9d16829a84a20877b3d961d13f395ce105b |
File details
Details for the file mokeidb-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: mokeidb-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.0 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 | d784f9d7795a6a4fdbda5226abb374de5e920b9d0916eec448fb85e756e3d2d8 |
|
MD5 | 80bb9f36ac8f06a71d1356ea76e31e01 |
|
BLAKE2b-256 | c7aef37e312ec22030599026a78350b1f78b7a3c70fce3b8f5f72d844a8ae8c6 |