What this is about
Two things in CDMS look similar and are often confused:
- System fields such as
_createdOn,_updatedOnand_userIdare on the object itself. Every model has them. They show a single value, the current one. See System fields that the server sets. - The history is a list of revisions. Only audited models have it. It shows every state the object ever had, with person and time.
Side by side
- exist for every model
- one value per field, always the current one
_createdOn: time of creation_updatedOn: last PUT or PATCH_userId: who owns the object, only for user models- come along with every read and search
- gone as soon as the object is deleted
- only for audited models
- every state the object ever had
- every change: create, PUT, PATCH, upload, rollback, delete
- with person, time, IP address and user agent
- endpoint and role of its own
- stays readable after deleting
Which question is answered by what?
| Question | System fields | History |
|---|---|---|
| When was the object created? | _createdOn | ts of the ADD revision |
| When was it last changed? | _updatedOn, but only PUT and PATCH | ts of the newest revision, any kind of change |
| Who created it? | for user models the person in _userId, otherwise not | username of the ADD revision |
| Who changed it last? | cannot be answered | username of the newest revision |
| What was in it before? | cannot be answered | revision of the older revisions |
| Was it deleted, and by whom? | cannot be answered, the object is gone | the DEL revision |
Where they meet
When: set on create
Never changes after that, not even on a rollback. The ADD revision carries almost the same time in revisionMeta.ts. It is only created at the end of the request, so a fraction of a second later. For models that were audited only later, this revision is missing.
When: set to now on every PUT and PATCH
It stays empty on create and unchanged on a rollback. So a rollback is a change that _updatedOn does not show, but the history does: as a new MOD revision.
When: only for user models, set on create
Says who owns the object and drives the owner filter. It does not say who changed it last. That is only in the history.
Result: See Only your own data (owner filter).
When: for audited models, on every change
Every revision records the whole state, including the system fields. Through + and *, however, the history only returns the business fields, _createdOn and _updatedOn are empty there. You read the time of a revision from revisionMeta.ts.
When: Auditing is off.
There are only the system fields. CDMS does not know who changed something and what was in it before.
Pitfalls
What comes next
- The system fields in detail: System fields that the server sets
- Fetching revisions: Reading the history
- What is audited: What is audited