There are two collections -
- employee_data - contains emp_id, name
- building_consumption - contains consumption for different dates
Both these collections have no field in common.
I want to calculate sum of consumption till now from building_consumption and divide that by total employees in employee_data collection.
How to create an aggregate for this in mongodb? Shall I use $lookup, if yes then how?