...
- Offsets are serialized with data:
- Order of fields is not guaranteed - for optimization like compaction.
- First 4bytes - offset to the root of vtable, that stores offsets to other fields. Vtable can be anywhere relative to fields.
- Size of data must be know before serializing to prepare the vtable.
- It starts serializing from nested objects, calculate it sizes and fill tables, and then write root object.
- No streaming is possible.
Avro
https://avro.apache.org/docs/
- Avro relies that schema is known on both sides. And avoid writing field numbers, offsets. Only data. And it can be done in streaming way.
- Schema resolution is based on field names.
Bson
- Writes field names like json. Suppose that received doesn't have a schema.