{"id":"mongodb-web-analytics","schemaVersion":1,"revision":"2026-09-14.1","status":"researching","title":"Should web analytics events use a MongoDB time-series collection?","area":"Storage choice · workload constraints","summary":"A timestamped event can fit the time-series shape, but exact deduplication and event corrections change the choice. Evaluate the workload before choosing the collection type.","constraints":["Count page views per site and hour using synthetic events.","Client retries can send the same event twice.","Decide whether individual event corrections are required."],"collection":{"agent":"Codex","model":"GPT-6","resolvedModelRevision":null,"method":"official-documentation-review","checkedAt":"2026-09-14","review":"unreviewed"},"subjects":[{"id":"mongodb","name":"MongoDB Community","role":"Database engine","productId":"mongodb"},{"id":"mongodb-atlas","name":"MongoDB Atlas","role":"Optional managed deployment; not a different collection model","productId":"mongodb-atlas"}],"sources":[{"id":"mongo-create","title":"Create and query time-series collections","url":"https://www.mongodb.com/docs/manual/core/timeseries/timeseries-procedures/","locator":"Create a time series collection","checkedAt":"2026-09-14","version":"Living documentation; runtime versions not pinned"},{"id":"mongo-limits","title":"Time-series limitations","url":"https://www.mongodb.com/docs/manual/core/timeseries/timeseries-limitations/","locator":"Updates; Time Series Secondary Indexes; Modification of Collection Type","checkedAt":"2026-09-14","version":"Living documentation; runtime versions not pinned"}],"claims":[{"id":"time-shape","text":"MongoDB time-series collections configure a timeField and an optional metaField.","scope":"Collection creation; choose fields for the actual event workload.","kind":"documented","evidenceIds":["mongo-create"]},{"id":"no-unique","text":"MongoDB documents that time-series collections do not support unique indexes.","scope":"Time-series collections only; this is not a limitation asserted for all MongoDB collections.","kind":"documented","evidenceIds":["mongo-limits"]},{"id":"restricted-updates","text":"Time-series updates may match and modify only the metaField and cannot use upsert.","scope":"Current documented update restrictions; pin the deployed version before implementation.","kind":"documented","evidenceIds":["mongo-limits"]},{"id":"collection-choice","text":"An existing collection cannot be converted in place into or out of a time-series collection.","scope":"Moving existing data requires migration.","kind":"documented","evidenceIds":["mongo-limits"]}],"alternatives":[{"title":"Time-series event collection","tradeoff":"Candidate for timestamped, append-oriented measurements. Exact duplicate prevention cannot rely on a unique event-ID index on this collection (claim: no-unique). Deduplication needs a separate design."},{"title":"Regular event collection","tradeoff":"Candidate to investigate when event identity and corrections dominate. This research has not yet established its index strategy, performance, or operational cost."}],"gaps":["Define whether duplicate page views are acceptable and where deduplication occurs.","Pin MongoDB server version, deployment, indexes and retention policy.","Benchmark identical fixtures before making any speed or cost claim."],"recipe":{"id":"analytics-collection-probe","title":"Evaluate analytics collection semantics with a tiny fixture","status":"untested-draft","dependencyClaimIds":["time-shape","no-unique","restricted-updates","collection-choice"],"steps":[{"title":"Write the event contract","instruction":"Use synthetic eventId, timestamp, siteId and path fields. Decide whether retries must count once and whether paths can be corrected later.","expected":"An explicit duplicate and correction policy."},{"title":"Prepare isolated candidates","instruction":"On a disposable MongoDB instance, pin the server version and create separate regular and time-series candidates. For time-series, select timestamp as timeField and site metadata as metaField. Record all options.","expected":"Two reproducible collection configurations; no production data touched."},{"title":"Load a deterministic fixture","instruction":"Prepare three distinct events in one site/hour and replay one event ID. Query hourly counts under each chosen ingestion policy.","expected":"Three views if deduplication is required; four raw events otherwise. Record the policy with the result."},{"title":"Exercise the rejected assumptions","instruction":"Try the required uniqueness and correction operations on the disposable candidates. Capture actual errors and query outputs; do not mark documentation as an observed run. Drop only the explicitly created test collections when finished.","expected":"Evidence showing which candidate satisfies the stated workload."}],"checks":[{"id":"duplicate","expected":"One retried event counts according to the explicit duplicate policy."},{"id":"hour-boundary","expected":"Events on opposite sides of the UTC hour boundary appear in separate buckets."},{"id":"correction","expected":"Required correction succeeds, or the candidate is recorded as unsuitable for that requirement."},{"id":"cleanup","expected":"Only the named disposable collections are removed."}]},"executions":[]}