Skip to main content
docs holds the content of the editable text files of a project (Overleaf calls them docs), for example main.tex or sample.bib. One document per doc: its lines, its comments and tracked changes, two counters and the deletion state. The file name and place in the tree are not here but in projects.rootFolder (see Projects Collection). Binary files are not here either. Apart from migrations and maintenance scripts, only docstore writes this collection, in services/docstore/app/js/MongoManager.js. There is no Mongoose model; web and document-updater reach it through the docstore HTTP API (services/docstore/app.js:31-70). In the Source column, bare file names are under services/docstore/app/js/.

Fields

Ranges

ranges has two arrays. document-updater builds them with libraries/ranges-tracker/index.cjs; docstore turns ids into ObjectIds and ts into Dates before saving (RangeManager.js:41-63). A doc without comments or tracked changes has ranges: {} or no ranges. The text of a comment and its replies is not in docs: it is in the messages collection, in the room whose thread_id is the comment id. Whether a comment is resolved is stored on that room, not here; docstore drops a resolved flag if one is sent (RangeManager.js:59-61). See Rooms Collection and Messages Collection.

Who Writes It

Who Reads It

Indexes

All come from migrations tagged server-ce in tools/migrations/.

Notes

  • While a doc is open, its newest text is in document-updater (Redis), not here. Mongo is only updated when document-updater flushes (services/document-updater/app/js/PersistenceManager.js:128-160). Code that reads the docs of a whole project should call flushProjectToMongo first, as ProjectDuplicator does.
  • Deleted docs stay in this collection, with deleted: true, until the project is destroyed. docstore returns at most MAX_DELETED_DOCS (default 2000) of them, newest first (MongoManager.js:29-44, services/docstore/config/settings.defaults.cjs:40). The history panel does not use them; it reads history-v1.
  • The rev and version counters are unrelated to project history versions in history-v1.
Here are real examples of Overleaf docs.
Last modified on November 14, 2026