The New Sensor Sends a Different Document

Some readers still expect temp_c while a new device sends a value and a unit. Introduce an explicit representation version and a reader that can explain both.

13 sections · 4 questions · 1 coding challenge

1 / 13

Letting Old and New Records Coexist During a Change

BOTIE

Document databases permit records with different shapes, which can make a gradual rollout possible. MongoDB’s schema-versioning pattern documents an explicit version field and readers that understand the relevant shapes. The ability to store both versions is a mechanism; compatibility still has to be implemented.

The maintenance problem is a units change as well as a field move. An adapter can connect both representations to the same interpreted measurement while keeping their original meaning visible. Guessing from whichever field happens to exist would hide malformed or future records.

Sources for this history