Comment Database

Overview

MongoDB database storing all comments, mentions, reactions, and threaded discussions with flexible schema for rich-text content.

Collections

Technical Details

Specifications:

  • Version: MongoDB 7.x
  • Storage: 200 GB
  • Replication: 3-node replica set
  • Sharding: Sharded by workspace_id
  • Encryption: Encrypted at rest

Performance:

  • Query Latency: P95 < 100ms
  • Write Throughput: 2,000 writes/second
  • Connections: Max 500
  • Uptime SLA: 99.95%

Schema Design

Comments Document

{
"_id": "comment_123",
"workspace_id": "ws_456",
"task_id": "task_789",
"author_id": "user_101",
"content": {
"text": "Great work on this feature!",
"markdown": "Great work on **this feature**!",
"mentions": ["user_102", "user_103"]
},
"attachments": [
{
"id": "att_1",
"filename": "screenshot.png",
"url": "s3://bucket/workspace/comment/att_1",
"size": 102400,
"mime_type": "image/png"
}
],
"reactions": {
"πŸ‘": ["user_102", "user_103"],
"πŸŽ‰": ["user_104"]
},
"thread_id": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"edited": false
}

Indexing

  • workspace_id + task_id + created_at - Fetch comments for task
  • author_id + created_at - User’s comment history
  • mentions - Find comments mentioning user
  • content.text - Full-text search

Access Patterns

  • Comment Service: Full read/write access
  • Task Service: Read comment counts
  • Notification Service: Read mentions for notifications
  • Search: Full-text search across comments

Disaster Recovery

  • RPO: 1 hour
  • RTO: 2 hours
  • Backup Retention: 30 days
  • Point-in-Time Recovery: 24 hours