Owner Nikunj

Bookmark

1. What is a Bookmark?

Bookmark lets a user save MCQs for later and organize them into collections. It’s the student’s personal shelf — separate from publishing / curation.

Two concepts to keep straight:

  • Bookmark — a single record marking one MCQ as saved by one user.
  • Collection (a.k.a. “bucket”) — a user-owned named folder that groups bookmarked MCQs (e.g. “Revise before exam”). Every user automatically gets one default “All Bookmarks” collection per course.

Bookmarks today apply to MCQs only.

2. Connection With Other Entities

   ┌────────────┐
   │   USER     │
   └─────┬──────┘
         │ owns

         ├──────────────────────────────┐
         ▼                              ▼
   ┌────────────┐  groups        ┌────────────┐
   │ COLLECTION │ ──────────────▶│  BOOKMARK  │
   │  (bucket)  │                │  (record)  │
   └────────────┘                └─────┬──────┘
                                       │ points at

                                 ┌────────────┐
                                 │    MCQ     │
                                 └────────────┘

         Bookmark state is also mirrored onto MCQ ATTRIBUTES
         (`bookmark_status` + `bookmark_collection_ids`) so the
         mobile sync can deliver attempts + bookmarks in one payload.

In plain English: every User owns many Collections and many Bookmark records. A Collection groups bookmark records. Each Bookmark points at one MCQ. The same state is denormalized onto the user’s MCQ Attributes row for fast mobile sync.

Everything is course-scoped: collections and bookmarks for NEET are separate from UPSC, even for the same user.

3. Parameters

3.1 Bookmark record fields

  • _id — unique ID
  • unique_key — composite key of the form {course_id}_{user_id}_{content_id}; guarantees one bookmark row per user per MCQ per course; primary index for fast lookups
  • user_id — the user who owns this bookmark
  • content_id — id of the saved MCQ
  • content_short_uid — short UID of the saved MCQ (e.g. MCQ3QJKBYM); used for cross-references and deep linking
  • is_bookmarktrue if currently saved, false if the user unbookmarked it; row is retained either way for history and counts
  • course_id — the course this bookmark belongs to (NEET, UPSC, etc.); used for scoping
  • is_deleted — soft-delete flag
  • created_at / updated_at — epoch-µs timestamps (UTC); updated_at advances on every toggle
  • created_by / updated_by — user IDs of the actor (usually the same as user_id)

3.2 Collection (bucket) fields

  • _id — unique MongoDB ID
  • short_uid — auto-generated unique ID like BMC3QJKBYM; used for cross-references and deep linking from clients
  • user_id — the user who owns this collection
  • is_defaulttrue for the auto-created “All Bookmarks” collection (exactly one per user per course; cannot be deleted)
  • name — collection name, 1–150 characters
  • description — optional, max 500 characters
  • course_id — the course this collection belongs to; collections do not span courses
  • mcq_count — denormalised count of MCQs currently in this collection
  • is_deleted — soft-delete flag; cascades to strip this collection’s id from any mcq_attributes.bookmark_collection_ids that referenced it
  • created_at / updated_at — epoch-µs timestamps (UTC)
  • created_by / updated_by — user IDs of creator / last editor

4. Functionality

  • Bookmark / Unbookmark an MCQ
  • Add a bookmarked MCQ to one or more collections
  • Move bookmarked MCQs between collections
  • Create a new collection
  • Rename / edit a collection
  • Delete a collection — cascade strips the collection id from affected MCQ attributes; underlying bookmark records survive
  • Default “All Bookmarks” collection — auto-created per user per course; cannot be deleted
  • Sync collections + bookmark state for offline (mobile)