Diff Versions
Version History
Diff Versions
Compare two versions and get the changes between them
GET
Diff Versions
Compares two versions of a document and returns a detailed list of field-level changes between them.
Endpoint
Path Parameters
The name of the collection containing the document
The unique identifier of the document
The starting version number (must be less than v2)
The ending version number (must be greater than v1)
Authentication
Requires valid authentication. The user must haveread permission on the collection and access to the specific document.
Response
Returns the differences between the two versions.The starting version number (v1)
The ending version number (v2)
Example Request
Example Response
Diff Format Examples
Field Added
When a field is added in v2:Field Removed
When a field is removed in v2:Field Modified
When a field value changes:Nested Field Changes
Nested fields use dot notation:Array Changes
Arrays are compared as complete values:Object Changes
For nested objects, each changed field is reported separately:Diff Calculation
The diff engine:- Reconstructs both versions to their full document state
- Recursively compares all fields using dot notation for nested paths
- Identifies three types of changes:
- Added: Field exists in v2 but not v1 (
from: null) - Modified: Field value changed between versions
- Removed: Field exists in v1 but not v2 (
to: null)
- Added: Field exists in v2 but not v1 (
- Returns changes sorted by field name for consistent ordering
Field-Level Permissions
Changes to fields that the user doesn’t have permission to read are automatically filtered out. If a field is in the deny list or not in the allow list, it won’t appear in the changes array.Error Responses
Bad Request - Invalid parameters or v1 >= v2
Unauthorized - Authentication required
Forbidden - Insufficient permissions
Not Found - One or both versions not found
Internal Server Error - Failed to compute diff
Not Implemented - Versioning is not enabled
Use Cases
- Audit Trail: Review what changed between versions
- Change Tracking: Monitor specific field modifications over time
- Compliance: Generate reports showing data changes for regulatory purposes
- Debugging: Identify when and how a field value changed
- Approval Workflows: Show reviewers what will change before approving
Notes
- Changes are sorted alphabetically by field name
- Only fields that actually changed are included in the response
- The comparison is performed on the reconstructed full documents
- Denied fields are excluded from the changes array
- Both versions must exist for the document