Skip to main content

Module transform

Module transform 

Source
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.

Functionsยง

mongo_object_to_parse
mongoObjectToParseObject.
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.
value_to_bson_for_query
Lower a value for use in a query filter on field.