← Investigations
Storage choice · workload constraints / RESEARCH IN PROGRESS

Should web analytics events use a MongoDB time-series collection?

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.

Documentation reviewedUnreviewed synthesis0 executions
01 / UNDER THESE CONDITIONS

A scoped answer, with choices.

  • 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.
RESEARCH INTERPRETATION

Time-series event collection

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.

RESEARCH INTERPRETATION

Regular event collection

Candidate to investigate when event identity and corrections dominate. This research has not yet established its index strategy, performance, or operational cost.

02 / WHAT THE SOURCES ESTABLISH

Claims you can inspect.

DOCUMENTED / time-shape

MongoDB time-series collections configure a timeField and an optional metaField.

Collection creation; choose fields for the actual event workload.

Source: Create and query time-series collections

Create a time series collection · Checked 2026-09-14

Living documentation; runtime versions not pinned

Inspect original source ↗
Used by this recipe ↓
DOCUMENTED / no-unique

MongoDB documents that time-series collections do not support unique indexes.

Time-series collections only; this is not a limitation asserted for all MongoDB collections.

Source: Time-series limitations

Updates; Time Series Secondary Indexes; Modification of Collection Type · Checked 2026-09-14

Living documentation; runtime versions not pinned

Inspect original source ↗
Used by this recipe ↓
DOCUMENTED / restricted-updates

Time-series updates may match and modify only the metaField and cannot use upsert.

Current documented update restrictions; pin the deployed version before implementation.

Source: Time-series limitations

Updates; Time Series Secondary Indexes; Modification of Collection Type · Checked 2026-09-14

Living documentation; runtime versions not pinned

Inspect original source ↗
Used by this recipe ↓
DOCUMENTED / collection-choice

An existing collection cannot be converted in place into or out of a time-series collection.

Moving existing data requires migration.

Source: Time-series limitations

Updates; Time Series Secondary Indexes; Modification of Collection Type · Checked 2026-09-14

Living documentation; runtime versions not pinned

Inspect original source ↗
Used by this recipe ↓
03 / untested draft

Evaluate analytics collection semantics with a tiny fixture

This is a procedure draft, not a working implementation. Package versions and executable artifacts are not yet pinned.

  1. Write the event contract

    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.

  2. Prepare isolated candidates

    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.

  3. Load a deterministic fixture

    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.

  4. Exercise the rejected assumptions

    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.

04 / NO RESULTS YET

What would count as evidence?

Not attempted

One retried event counts according to the explicit duplicate policy.

Not attempted

Events on opposite sides of the UTC hour boundary appear in separate buckets.

Not attempted

Required correction succeeds, or the candidate is recorded as unsuitable for that requirement.

Not attempted

Only the named disposable collections are removed.

Resolve before calling this a recipe that works

  • 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.
Download continuation brief