Legacy Document Timestamps (created vs createdDate)
Overview
Compatibility layer between neo-backend document inserts and legacy API consumers (IP Magic Box, admin lists). Neo and Tower v2 write createdDate only; legacy Mongoose documents used both created and createdDate.
How it works
On JSON serialization (toObject / toJSON) and in document list routes, when created is missing but createdDate is present, the API exposes created as an alias of createdDate.
Downstream services that query Mongo directly (e.g. Forge fetch-new-docs) must filter on createdDate, not legacy created.
Key files
app/database/schema/document.js— Transform hooks setret.created = ret.createdDatewhen neededapp/routes/documents.js— List payloads includecreated: d.created ?? d.createdDate
Technical decisions
- Read-time proxy, no backfill: Avoids a mass migration; legacy manual deposits already have
createdDate. - Write path unchanged for manual deposit: IP Magic Box still sets
createdDateonPOST /documents.
Known issues
- Raw Mongo documents from neo may still lack a
createdfield until read through the API layer.
Next steps
- Align all internal aggregations on
createdDateas the canonical field