[SERVER-3958] Ability to track changes made to a collection Created: 27/Sep/11 Updated: 06/Dec/22 Resolved: 12/Dec/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Storage |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Paulo Pinto | Assignee: | Backlog - Storage Execution Team |
| Resolution: | Done | Votes: | 4 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Storage Execution
|
| Participants: |
| Description |
|
I'd like to be able to track the changes made to a collection. I'll attempt to describe how this could be implemented so it's clear what I'm proposing, but I don't know if this would be the best way. Once this feature has been activate in a collection, any change made to that collection would cause a new document to be created in a another collection. The change document could look like: _id : ObjectID() // unique id for this change The parentChanges array above is used so we can track the order in which the changes were made. If the array is empty, then this is the first change. If the array has one change, that is the parent change. If the array has 2 changes, then this change is a merge change (much like the mercurial or git track their changes). The previousContent and newContent properties only store the information that was actually changed and not the whole document that was changed. As I said before, I don't know if this would be the best way to implement this feature, but the important points in this feature are:
|
| Comments |
| Comment by Eric Milkie [ 12/Dec/17 ] |
|
The "Change streams" feature was released in version 3.8; you could use it to implement something akin to your suggestion. |