Mongo peoplebase
Here are eight famous people:
Id | First Name | Last Name | Year of Birth | Year of Death |
---|---|---|---|---|
1 | Marilyn | Monroe | 1926 | 1962 |
2 | Abraham | Lincoln | 1809 | 1865 |
3 | Nelson | Mandela | 1918 | 2013 |
4 | Winston | Churchill | 1874 | 1965 |
5 | Bill | Gates | 1955 | – |
6 | Charles | Darwin | 1809 | 1882 |
7 | Pele | – | 1940 | – |
8 | Fidel | Castro | 1926 | – |
-
Create a mongo database and a collection called
people
that would store the information presented above. -
Create a query or a series of queries that would fill the table with the information above. Put the query/queries below:
... here goes your code ...
-
Create a query that would return everything from the table:
... here goes your code ...
-
Create a query that would return a single row: the person with the ID of 5.
... here goes your code ...
-
Create a query that would return the four people with the following IDs: 1, 3, 7, 8.
... here goes your code ...
-
Create a query that would return all the people except the person with the ID of 4 (
Winston Churchill
).... here goes your code ...
-
Create a query that would select the people who were born after 1920:
... here goes your code ...
-
Create a query that would select the living people:
... here goes your code ...
-
Create a query that would return everyone who has died:
... here goes your code ...
-
Create a query that would select the people with their first starting with an
M
:... here goes your code ...
-
Create a query that would select the people with either their first or last name starting with a
C
:... here goes your code ...
-
Create a query that would select the people born after 1900 with their last name starting with a
C
:... here goes your code ...
-
Create a query that would select all the people except those whose last name starts with a
C
:... here goes your code ...
-
Create a query that would select the people whose first name starts with a letter that precedes
M
in the English alphabet:... here goes your code ...
-
Create a query that would return all the people sorted by their last name alphabetically:
... here goes your code ...
-
Create a query that would return the living people sorted in the reverse alphabetical order by their first name.
... here goes your code ...
-
Create a query that would return the people sorted by their year of birth in the descending order, and then (if two or more people share the same year of birth) by their last name alphabetically:
... here goes your code ...
-
Set everyone’s last name to your last name:
... here goes your code ...
-
Update the first name of everyone who was born before 1900 to your favorite character’s name:
... here goes your code ...
-
Add 1 to both the year of birth and year of death for everyone whose ID is less than 5:
... here goes your code ...
-
Delete from the table everyone who died before 2000:
... here goes your code ...
-
Delete everyone from the table:
... here goes your code ...
Don’t forget to create a pull request.