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[int]
    a1: str  # Required
    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 = 0
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 == str(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.2.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ext-mongo-0.2.0.tar.gz
  • Upload date:
  • Size: 2.8 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.2.0.tar.gz
Algorithm Hash digest
SHA256 6ec0402869838f33fb95faed40f351c909811497e32cf2d0ab9a2b80a19697ca
MD5 7c48e7877965c0267a65ceedda04d3e1
BLAKE2b-256 642d6f6db99f1c24f1beb81936eda28d26dd4102002d833d3325f9c8c5386b84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ext_mongo-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35a8eb87a43b580b0c012f7337f369b46e86109c22c6fe6998075f153a29f3a8
MD5 8abd0589d4d990b5fd72adc366c8c9d7
BLAKE2b-256 f7d1a1cc3323cad11f709a02cd9f2e2f26a6be382aa2374af0c252862319122d

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