Skip to main content

No project description provided

Project description

Depends on environment variables:

  • MONGO_DB (Required)
  • MONGO_HOST (Optional)
  • MONGO_PASSWORD (Optional)
  • MONGO_USER (Default: "root")
  • MONGO_PORT (Optional)

Example:

from datetime import datetime, date

from bson import ObjectId

from mongo import Document, PrimaryKey


class Doc(Document):
    key: PrimaryKey[str]
    a1: str | None
    a2: int | None
    a3: bool | None
    a4: float | None
    a5: ObjectId | None
    a6: datetime | None
    a7: date | None
    b1: list[str]
    b2: list[int]
    b3: list[bool]
    b4: list[float]
    b5: list[ObjectId]
    b6: list[datetime]
    b7: list[date]
    c1: dict
    c2: list[dict]


KEY = "key"
A1 = "a1"

d = Doc(key=KEY, a1=A1).save()

assert Doc.get(KEY) == d
assert Doc.find(a1=A1) == d
assert Doc.find_all(a1=A1) == [d]
assert d.str_id == KEY
assert d.to_dict() == {
    "_id": "key",
    "a1": "a1",
    "b1": [],
    "b2": [],
    "b3": [],
    "b4": [],
    "b5": [],
    "b6": [],
    "b7": [],
    "c1": {},
    "c2": [],
}

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

ext-mongo-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

ext_mongo-0.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file ext-mongo-0.1.0.tar.gz.

File metadata

  • Download URL: ext-mongo-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.9 CPython/3.10.5

File hashes

Hashes for ext-mongo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8d5fe207e6cf07c7a31fc40fbf3f1195f4342e643c9d43141546ec7847e1bdb8
MD5 f501018040b75bf8b53edc9b622aff53
BLAKE2b-256 75df9bd897242b169b7348383fc0ec90c0835840182d5409ab60de813aa0b0b8

See more details on using hashes here.

File details

Details for the file ext_mongo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ext_mongo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.9 CPython/3.10.5

File hashes

Hashes for ext_mongo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c1340d7f55e670e6b0840f72c23088cd029fff7ce63661c0a2e78c4d698893b
MD5 d6903b449642f232cd8cc7f9af648d1d
BLAKE2b-256 490ee4c5ac40e6cac0bfadb73dff638bb5ae6725469531cde7657f5005feb316

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