Question: Cities and restaurants are collections inside of a database (using MongoDB). The cities have three fields: _id, pop (for population), and city (for the city
Cities and restaurants are collections inside of a database (using MongoDB). The cities have three fields: _id, pop (for population), and city (for the city name). The restaurants have three fields: _id, cuisine, and a subdirectory named address, another subdirectory named coord, which contains the x-coordinate (labeled [0]) and the y-coordinate (labeled [1]). coord is an array.
With MongoDB, create four functions:
1. Query the cities that begin with the letter, "A", then find the average population.
2. Query, and find the standard deviation of the populations.
3. Query the restaurants, then return the address subdirectories that are within these coordinates: (-70 to -30), (10 to 80).
4. Query, then return all restaurants with zip codes as 10000 or 10101, then return the number of restaurants that serve the respective cuisines. (So if there is "cuisine" : "Asian", the amount of Asian foods in the area increase by 1.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
