M121 chapter 1 : Homework one

HI,
I have spent some time on this trying to remember what I learned on the m001 course.
please tell me what is wrong in this query:

You are missing double quote on Japanese

Thanks for trying to help , but the error is still there.


There is a message for error on position 47.

Hi @farideh_gorji,
There are multiple syntactical mistakes in your pipeline.
First of all, $match accepts a single object with one or more key-value value pairs.
But your pipeline:

{ $match: {{ "$imdb.rating": "$gte": 7}}, { $nor: [...]} }...

is not following the correct syntax.
Secondly, your $match expression { "$imdb.rating": "$gte": 7} is also incorrect. Also, you don’t need to prepend a $ in front of the key-name. It should be as below:

{"imdb.rating": {$gte: 7} }

Having said that, I would recommend you to take our free The MongoDB Aggregation Framework course to get a better understanding of aggregation pipelines.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

I don’t understand. The m121 is the MongoDB Aggregation Framework course.

The lecture 0 and the lecture 1 are not helpful for installation and do not have example for several queries using $match.

Hi @farideh_gorji, please complete all the lectures from Chapter 0 & Chapter 1 and hopefully by the end of it you will get a better understanding of it.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

I have done that. It just says that you can repeat $match as many times as you want.
That’s what I am going to do .
Use $match four times.

You should try to learn to do it the right way rather that just patching your errors.

The first thing is to have all your quotes. In the original query, you were missing quotes at both "$gte: 7 and "Japanese. Both errors already mentioned by other people.

Using $match multiple times won’t help you in those cases.

Braces are important, in JSON documents and queries. You should not have 2 opening braces like {{ you have to start your $match. That is what is meant by

1 Like