The current MongoDB schema separates the main health record and its updates into two different Mongoose models. This task aims to refactor the schema to follow a more unified structure, similar to the SQL backend, where updates are treated as child records of a parent health record.
Requirements
Notes
- This change is intended to align the MongoDB schema more closely with the SQL backend design.
- The updated structure should still support expansion of child records into full objects when queried.
The current MongoDB schema separates the main health record and its updates into two different Mongoose models. This task aims to refactor the schema to follow a more unified structure, similar to the SQL backend, where updates are treated as child records of a parent health record.
Requirements
parentIdfield:- If
parentIdisnullorundefined, the record is a top-level health record.- If
parentIdis set, the record is considered an update (child).updatesarray to top-level records to store child record IDs.parentId) are allowed to have anupdatesarray.updatesarrays).Notes