file-linesDocs Collection

Docs: Docs is overleaf's internal term of an editable file, for example, a pure tex file, or a .bib file. It stores the file content, revision information, and deletion state.

Core Identification

  • _id: Unique MongoDB ObjectId identifying this document record.

  • project_id: Reference to the project (Project._id) this file belongs to.

  • name: Filename as shown in the project file tree (e.g., main.tex, sample.bib).

Revision & Versioning

  • rev: Revision number of this document within the project history.

  • version: Internal schema or format version used by the editor backend.

These fields are used by Overleaf’s custom versioning system to track incremental edits and support history and rollback.

File Content

  • lines: Array of strings representing the file content line by line. Each element corresponds to one logical line in the source file.

    In this example, it stores a BibTeX entry:

    • @article{greenwade93, ... }

  • ranges: Data structure reserved for editor annotations or tracked ranges (e.g., selections, comments, or change tracking). Empty when no active ranges are present. op Operation object that binds the comment to a specific position in the document.

    • op.c — Comment Selected Text (Character Contents)

    • op.p — Anchor Position (Character Offset)

    • id Unique ObjectId of this comment entry.

    • metadata Author and timestamp information.

Deletion State

  • deleted: Indicates whether this document has been deleted from the project.

  • deletedAt: Timestamp recording when the document was deleted.

Deleted documents are usually kept for history recovery and version browsing rather than being immediately removed from the database.

Here is an real example for an Overleaf docs.

chevron-rightA Simple Examplehashtag

chevron-rightA Complicated Examplehashtag

Last updated