httk.store.mongo.documents¶
Encoding and decoding of MongoStore record documents.
Exceptions¶
A record document exceeds the connected MongoDB BSON limit. |
Functions¶
|
Encode projected field values into the record's |
|
Decode a MongoDB record document into its concrete storable instance. |
|
Raise when |
Module Contents¶
- exception httk.store.mongo.documents.RecordTooLargeError[source]¶
Bases:
ValueErrorA record document exceeds the connected MongoDB BSON limit.
- httk.store.mongo.documents.encode_record(schema, projected, source, record_type, resolve_reference)[source]¶
Encode projected field values into the record’s
fdocument.- Parameters:
schema (httk.store.db.schema.TableSchema) – The resolved record schema.
projected (collections.abc.Mapping[str, object]) – The backend-neutral storage projection.
source (Any) – The source object used for derived stored properties.
record_type (type) – The record representation being encoded.
resolve_reference (collections.abc.Callable[Ellipsis, int]) – Callback saving a reference and returning its sid.
- Returns:
The embedded
fdocument.- Return type:
- httk.store.mongo.documents.decode_record(schema, document, resolve_reference)[source]¶
Decode a MongoDB record document into its concrete storable instance.
- Parameters:
schema (httk.store.db.schema.TableSchema) – The resolved record schema.
document (collections.abc.Mapping[str, Any]) – The complete MongoDB record document.
resolve_reference (collections.abc.Callable[[type, int], Any]) – Callback hydrating a referenced sid.
- Returns:
A concrete record instance.
- Return type:
Any
- httk.store.mongo.documents.preflight_document(document, max_bson_size, record_type)[source]¶
Raise when
documentcannot be accepted by MongoDB’s BSON limit.- Parameters:
document (collections.abc.Mapping[str, Any]) – Candidate record document.
max_bson_size (int) – The server BSON limit read at store construction.
record_type (type) – The record class used in the diagnostic.
- Returns:
None.
- Raises:
RecordTooLargeError – If BSON encoding exceeds the server limit.
- Return type:
None