MongoDB storage¶
httk.store.mongo stores the same plain frozen dataclasses as the SQL layer in
MongoDB’s document model: one document per record, embedded child arrays, and
the same neutral Store/Searcher protocols, entry-family dispatch, and
entry-provider surface as SqlStore.
python -m pip install "httk-store[mongodb]"
from httk.store.mongo import MongoDatabase, MongoStore
uri = "mongodb://127.0.0.1:27017/?replicaSet=httk2rs"
with MongoDatabase.connect(uri, database="materials") as database:
store = MongoStore(database, entry_records={})
# store.save(), store.fetch(), store.searcher() work as with SqlStore
Choose MongoStore when MongoDB is already your operational data service or
document-shaped records fit; choose SqlStore for relational deployments and
SQL’s stronger transaction model.
The full guide, MongoDB storage in detail, covers the document mapping, query translation, continuation paging, replica-set requirements, and the documented differences from the SQL backend.