split time series documents into intervals based on custom logic

Hi,

Could you please provide a data aggregation pipeline on how to split a time series collection into intervals based on changes on a specific parameter (boolean) in the documents?

Best regards,