Chapter 1. Lab1. [js] SyntaxError: missing ; before statement @(shell):3:3

Hi, can somebody help me with the error I am receiving on any query?

E QUERY [js] SyntaxError: missing ; before statement @(shell):3:3

sometimes it missing ) or } but I have checked it twice

Just for example a part of code I use:

var pipeline = ([ {
$match: {
{genres: [$nin: “Crime”, “Horror”]},
} }])

Thank you


You have some issues:

var pipeline = [
   {$match: {
      genres: { $nin: ["Crime", "Horror"] }

Note that your $nin expression is incorrect, it expects an array, and the whole expression must be enclosed in curly braces. You also have two open curly braces before the genres key, only one is needed.

José Carlos

Thank you, @jcarlosgarcia

I have found a typo and read about operators I should use. Now is working

You are welcome!

José Carlos