Expand description
The _SCHEMA document format.
This is the one place where a mistake breaks a mixed fleet silently rather than loudly, so it gets its own module and its own round-trip tests.
A _SCHEMA document is {_id: <className>, <field>: <short type string>, ...} plus
_metadata and _client_permissions. The type strings are terse and lossy-looking but exact:
parseFieldTypeToMongoFieldType (MongoSchemaCollection.js:126-152) going down, and
mongoFieldToParseSchemaField (:4-39) coming back.
Two hazards, both silent:
- Never add a key. parse-server reads an unknown top-level
_SCHEMAkey as a phantom field, so a key parse-rust invents for bookkeeping becomes a real column on every parse-server node reading the same database. - Never invent a type string.
mongoFieldToParseSchemaFieldis aswitchwith no default case, so an unrecognised type falls off the end and the field’s parsed entry becomesundefined, with no error anywhere.
Constants§
- NON_
FIELD_ KEYS - Keys in a
_SCHEMAdocument that are not fields (nonFieldSchemaKeys).
Functions§
- field_
type_ to_ storage - Lower a field type to its
_SCHEMAstring. - storage_
to_ field_ type - Raise a
_SCHEMAstring back to a field type.