Hi,
I have a large replica set, and in one of my collections, I have documents similar to the following:
{
device: integer,
date: string,
time: string,
voltage: double,
amperage: double
}
Data is inserted as time series data, and a separate process aggregates and averages results so that this collection has a single document per device every 5 minutes. ie. time is 00:05:00, 00:10:00, etc.
Here is what I’m trying to figure out. I have a subset of devices that I need to query for at once, and on the same date. Usually I’ll be searching for 5-10 devices, on the same date, and I need to find the time when all 5-10 devices are >= 27, and the summation of the amperages at that time is the lowest. The end result that I’m looking for is the time that this occurred.
I had been going down the path of searching for these devices with $in, and specifying the voltage, which works fine, but it didn’t guarantee that all 5 devices met that requirement.
Any suggestions on how to accomplish something like this?
Thanks