Fetching time-series data from different collections in a database

I have a time-series database with many different collections. Every collection has documents containing time data. I want to be able to query many variables, which come from separate collections within a specific date range. So if I want to look at for example a variable called ‘Power1’ from collection1 and a variable called ‘Power2’ from collection2 for the year 2022, how would I do this? Essentially I’m asking how to fetch data from different collections based on a date range.

Hello Alex,
You’re looking for an aggregation with a $lookup stage. If you want practical advice from this forum, it is recommend to write a data sample, so that we understand your model better.

1 Like