Computing Fields, problem with $split

Hi I was tring to complete the 2nd lab of the first chapter
in the $project there is a part that I have to insert a $split
As suggested in other part of this forum if there are problems control the code piece by piece.
I’m stuck with the first part of the lab
the $split part.
I wrote variable: {$split: [title, ‘ ‘ ] } inside the project, but mongoDB rise an error SyntaxError: illegal character @(shell):6:31 The 31 refeers to the first [ from the documentation seems that split has to be done in this way
$split : [variable, “what character you want to use to divide the string”]
Thanks for the help

Does your $project have the following form. I grabbed the example from the docs

 { 
   $project : {
     city_state : { $split: ["$city", ", "] },
     qty : 1
   }
 }
1 Like