Expand description
Parse JSON to BSON and back.
Upstream: src/Adapters/Storage/Mongo/MongoTransform.js. It is full of load-bearing special
cases, and those special cases are the whole job: the naive transform is trivial and wrong.
The pair implemented here mirrors parseObjectToMongoObjectForCreate and
mongoObjectToParseObject, which are the two functions upstream exports and therefore the
two this can be differentially tested against. See tests/transform_differential.rs.
Scope is the 0.1.0 field set: String, Number, Boolean, Date, Array, Object, Pointer, ACL,
plus the 0.2.0 additions: the $or/$and/$nor query tree, $all, $regex, the update
operator set, and Relation fields (which have no column at all).
Functionsยง
- bson_
document_ to_ parse_ map - Raise a stored sub-document into Parse form, verbatim.
- bson_
to_ parse_ value - Raise a stored value. Takes no schema: the stored form is self-describing, which is the
asymmetry with lowering, where the schema decides whether a field is a
_p_pointer. - index_
key_ to_ bson - Lower one entry of an index key document.
- mongo_
object_ to_ parse mongoObjectToParseObject.- parse_
map_ to_ bson_ document - Lower a Parse map into a stored sub-document, applying no policy.
- parse_
object_ to_ mongo_ create parseObjectToMongoObjectForCreate.- storage_
key - Keys that are renamed rather than stored under their Parse name (
transformKey,MongoTransform.js:7-30). The list is closed: everything else keeps its name, except a declared Pointer field, which takes a_p_prefix. - transform_
update transformUpdate: lower an update AST into a Mongo update document.- transform_
where transformWhere: lower a query tree into a Mongo filter document.- value_
to_ bson_ for_ query - Lower a value for use in a query filter on
field.