Complex mongodb search query in Meteor


#1

Basically it is a question about search query in mongodb. I have collections Companies, Employees, Services and Orders. And my search query has this parameters: city - date - service.

Example: New York 22.03.2015 05:30PM cleaning

As a result I need to get list of services from New York companies available(not ordered yet) on date 22.03.2015 05:30PM.

Step 1. By “city” I get companies from Companies collection
Step 2. By “service name - cleaning” and “received companies - Step 1” I get services from Services collection
Step 3. And finally all orders are in Orders collection and I need to know which “received services - Step 2” are available on this date.

How to construct mongodb search query in Meteor in this case?