For the Lab I wrote following code.created new field splitTitleSize
db.movies.aggregate([
{$project:{_id:0
,title:1
,splitTitleSize:{$size:{$split:["$title", " “]}}}
},
{$match:{”$splitTitleSize":1}
}
])
but it’s giving following error
“errmsg” : “unknown top level operator: $splitTitleSize”
Could you please tell me what is wrong here?
1 Like
You do not need the dollar sign.
2 Likes
The $ sign is not needed, it should be,
{$match:{"splitTitleSize":1}}
1 Like
Thank you !! It worked.
1 Like
Thank you!!
1 Like