advancedTop 30 Scenario-Based Questions
How would you design a document approval workflow using MongoDB and Redis?
Workflow design: 1) MongoDB schema: Document {_id, title, content, status: DRAFT|PENDING|APPROVED|REJECTED, submitterId, approverId, comments:[...], history:[{status, changedBy, changedAt}], version:1}. 2) State machine: only valid transitions allowed. MongoDB document update with state validation. 3) Redis for pending approvals: ZADD pending:approvals {timestamp} {documentId}. Approver views: ZRA
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.
How would you design a document approval workflow using MongoDB and Redis?