fetching data from mongo dB under a condtion

I need help in a logic. coming to the point I am building an api in nodejs and mongo db. here I have calories and meal coming from user in the URL as a query. let's say calorie is 1400 and meals are 3 so I have to divide these calorie into 3 meal like 466 in each meal. Now I have to fetch foods or dishes from the database which complete the calories of each meal. means I have egg in my data base whose calorie is 72 and a dish tandoori chicken having calorie 395 so these two foods complete first meal of 466(395+72) so I have to display only these 2 foods in the first meal and i have to do the same in 2nd and 3rd meal. I hope you all understand what I mean. my english not much good.one more thing I have two collection from which am fetching data one is recipe and second is nutritin. recipe colletion has all the high calorie food and nutrition colletion has small calorie food like egg milk tofu and all here is my code

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum