From Progzoo
Revision as of 09:27, 4 July 2015 by Andr3w (talk | contribs) (Large Countries)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The mongo collection progzoo contains the document world. Each element of world represents a country such as:

     _id:        "558b1fd3b0323f891aeb2010",
     area:       640679.0,
     capital:    "Paris",
     continent:  "Europe",
     flag:       "//",
     gdp:        2611221000000.0,
     name:       "France",
     population: 65906000.0
     tld:        ".fr",

Capital of France

The query given show the GDP of United Kingdom.

What is the capital of France?

[Font] [Default] [Show] [Resize] [History] [Profile]

Large Countries

The $lt operator is short for "less than". This query shows all countries with an area of less than 100 square kilometers

Show each country where the population is greater than 200 million (200000000).

[Font] [Default] [Show] [Resize] [History] [Profile]

Per Capita GDP

Show the per capita GDP for the countries of Europe. That is the gdp divide by the population.

You will need to use aggregation with $match, $project and $divide to complete this.

[Font] [Default] [Show] [Resize] [History] [Profile]