<!-- llms-explorer concept facts · https://llms-explorer.com/tree/session-windows/ · pack 2026-10-23 · ~816 tokens -->

# Session Windows

> Source-anchored research for Session Windows. Run status: COMPLETED.

Parent: [MongoDB Atlas Stream Processing](https://llms-explorer.com/tree/mongodb-atlas-stream-processing/) · 2 facets · 10 facts · page: https://llms-explorer.com/tree/session-windows/

## How it works

- In Atlas, $sessionWindow runs a nested aggregation pipeline over each session and releases its results to the next stage when that window closes. (high confidence) — [source](https://www.mongodb.com/docs/atlas/atlas-stream-processing/sp-agg-session.md)
- Atlas event-time sessions close when the watermark advances beyond the session’s maximum event timestamp plus gap and allowedLateness. Their start is the earliest event timestamp; their end is the latest event timestamp plus gap. (low confidence) — [source](https://www.mongodb.com/docs/atlas/atlas-stream-processing/sp-agg-session.md)
- Atlas sends documents to the DLQ when partitionBy evaluation fails, or when an event is older than the latest source watermark and has no open session. (low confidence) — [source](https://www.mongodb.com/docs/atlas/atlas-stream-processing/sp-agg-session.md)
- A practical Atlas pattern groups shopping activity by user, aggregates each session, and triggers downstream abandoned-cart actions after inactivity. (high confidence) — [source](https://www.mongodb.com/blog/post/product-release-announcements/mongodb-atlas-stream-processing-now-supports-session-windows)

## Facts and statements

- Session windows group activity into variable-length sessions separated by an inactivity gap; partitioning by user or device keeps each entity’s sessions independent. (high confidence) — [source](https://www.mongodb.com/docs/atlas/atlas-stream-processing/sp-agg-session.md)
- An out-of-order Atlas event can bridge and merge two open sessions belonging to the same partition. (low confidence) — [source](https://www.mongodb.com/docs/atlas/atlas-stream-processing/sp-agg-session.md)
- Atlas requires gap and pipeline. partitionBy is optional: omission puts every document into one null partition. Only a single field or simple expression is supported, not multi-key embedded documents. (low confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/atlas/atlas-stream-processing/sp-agg-session.md)
- Atlas defaults boundary to eventTime and allowedLateness to three seconds; specifying allowedLateness with boundary: processingTime is prohibited. (low confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/atlas/atlas-stream-processing/sp-agg-session.md)
- Do not assume session APIs are interchangeable: Azure exposes timeout and maximum duration, while Atlas’s documented $sessionWindow parameters expose gap and allowedLateness without a maximum-duration parameter. (medium confidence) — [source](https://learn.microsoft.com/en-us/stream-analytics-query/session-window-azure-stream-analytics)
- Implementation semantics differ: Azure documents a maximum-duration parameter, while Spark accepts dynamic per-row gaps. Neither option appears in the cited Atlas session-stage syntax. (high confidence) (verified as of 2026-10-23) — [source](https://learn.microsoft.com/en-us/stream-analytics-query/session-window-azure-stream-analytics)
