|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
|
|
|
|
|
<details><summary>Query</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
db.movies.find({ "genres": "Thriller" }).count()
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
@ -12,7 +12,7 @@ db.movies.find({ "genres": "Thriller" }).count()
|
|
|
|
|
|
|
|
|
|
<details><summary>Result</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
2658
|
|
|
|
|
```
|
|
|
|
|
</details>
|
|
|
|
@ -21,14 +21,14 @@ db.movies.find({ "genres": "Thriller" }).count()
|
|
|
|
|
|
|
|
|
|
<details><summary>Query</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
db.movies.find({ "title": { "$regex": /ghost/i } })
|
|
|
|
|
```
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
<details><summary>Result</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
_id: ObjectId("573a1392f29313caabcda826"),
|
|
|
|
@ -84,14 +84,14 @@ ain Stone. At first things look good, Stone sees Merriam as a younger version of
|
|
|
|
|
|
|
|
|
|
<details><summary>Query</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
db.movies.find({ "title": { "$regex": /ghost/i }, "year": { "$gt": 2013 } })
|
|
|
|
|
```
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
<details><summary>Result</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
_id: ObjectId("573a13ddf29313caabdb3f4b"),
|
|
|
|
@ -138,7 +138,7 @@ sten that a whale killed his beautiful Annabel Lee, but even he doesn't quite re
|
|
|
|
|
|
|
|
|
|
<details><summary>Query</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
db.movies.aggregate([
|
|
|
|
|
{ "$sort": { "awards.wins": -1 } },
|
|
|
|
|
{ "$limit": 1 }
|
|
|
|
@ -148,7 +148,7 @@ db.movies.aggregate([
|
|
|
|
|
|
|
|
|
|
<details><summary>Result</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
_id: ObjectId("573a13d5f29313caabd9cae7"),
|
|
|
|
@ -203,7 +203,7 @@ ity. In the twelfth year of his unforgettable odyssey, Solomon's chance meeting
|
|
|
|
|
|
|
|
|
|
<details><summary>Query</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
db.movies.aggregate([
|
|
|
|
|
{ "$match": { "runtime": { "$gt": 120 }, "imdb.rating": { "$lt": 2.0 }}},
|
|
|
|
|
{ "$sort": { "year": 1 } },
|
|
|
|
@ -215,7 +215,7 @@ db.movies.aggregate([
|
|
|
|
|
|
|
|
|
|
<details><summary>Result</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
_id: ObjectId("573a13dbf29313caabdaf3c6"),
|
|
|
|
@ -271,7 +271,7 @@ l landlord. The son flees the village and travels to Mumbai to make a life, but
|
|
|
|
|
|
|
|
|
|
<details><summary>Query</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
db.movies.aggregate([
|
|
|
|
|
{ "$match": { "runtime": { "$gt": 120 }, "imdb.rating": { "$lt": 2.0 } } },
|
|
|
|
|
{ "$sort": { "year": 1 } },
|
|
|
|
@ -289,7 +289,7 @@ db.movies.aggregate([
|
|
|
|
|
|
|
|
|
|
<details><summary>Result</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
_id: ObjectId("573a13dbf29313caabdaf3c6"),
|
|
|
|
@ -346,7 +346,7 @@ l landlord. The son flees the village and travels to Mumbai to make a life, but
|
|
|
|
|
|
|
|
|
|
<details><summary>Query</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
db.movies.aggregate([
|
|
|
|
|
{ "$unwind": "$countries" },
|
|
|
|
|
{
|
|
|
|
@ -373,9 +373,9 @@ db.movies.aggregate([
|
|
|
|
|
|
|
|
|
|
<details><summary>Result</summary>
|
|
|
|
|
|
|
|
|
|
It's very long. Here's part of the 2nd entry:
|
|
|
|
|
It's very long. Here's part of the 2nd document:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
...
|
|
|
|
|
'La Sapienza',
|
|
|
|
|
'The New Girlfriend',
|
|
|
|
@ -503,7 +503,7 @@ It's very long. Here's part of the 2nd entry:
|
|
|
|
|
### BONUS/ Trouver les cinémas aux alentours (5km maxi) de New York (x = -73.983487 et y = 40.76078)
|
|
|
|
|
<details><summary>Query</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
db.theaters.createIndex({ "location.geo": "2dsphere" })
|
|
|
|
|
|
|
|
|
|
db.theaters.aggregate([
|
|
|
|
@ -523,7 +523,7 @@ db.theaters.aggregate([
|
|
|
|
|
|
|
|
|
|
<details><summary>Result</summary>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
_id: ObjectId("59a47287cfa9a3a73e51e8e2"),
|
|
|
|
|