Need Assistance with 2nd Project Lab Exercise

Not sure if I’m on the right track, could you please advise.

MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movies.aggregate({$cond:{$eq:[$size:{$split:[‘title’,’ ']},1]},{$project:{_id:0,title:1}}}).itcount()
2019-01-12T22:01:01.988-0800 E QUERY [js] SyntaxError: missing ] after element list @(shell):1:38

What am i doing wrong?


Like the error message says: there is a syntax error. The aggregate method take an array of documents, each document is a stage. You do not pass an array to aggregate and the document { $cond : … } is not a stage.

1 Like

ok, thx for the clarification. lot to absorb and process.