Skip to content

Conversation

HyunSangHan
Copy link
Contributor

Closes: #4985

Context

Starting in MongoDB 7.0.3 and 7.1, $out can take a document to output to a time series collection:

{ $out:
  { db: "<output-db>", coll: "<output-collection>",
    timeseries: {
      timeField: "<field-name>",
      metaField: "<field-name>",
      granularity:  "seconds" || "minutes" || "hours" ,
    }
  }
}

More details: https://www.mongodb.com/docs/v8.0/reference/operator/aggregation/out/#syntax

Summary

Added time series collection support to $out aggregation operation.
Extend OutOperation to support MongoDB time series collections with configurable time field, metadata field, and granularity options.

  • Add timeSeries() methods to OutOperation for fluent API
  • Add static factory methods out() to Aggregation class
  • Support both simple and extended $out syntax for time series

MongoDB `$out` stage now supports creating time series collections with
configurable time field, metadata field, and granularity options.

Signed-off-by: Hyunsang Han <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 6, 2025
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 10, 2025
christophstrobl pushed a commit that referenced this pull request Jul 10, 2025
`$out` operation stage now supports creating time series collections with configurable time field, metadata field, and granularity options.

Closes: #4985
Original Pull Request: #4995

Signed-off-by: Hyunsang Han <[email protected]>
@christophstrobl
Copy link
Member

Thank you @HyunSangHan for your contribution! Merged to main development line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable $out aggregation to push to time series collection.
4 participants