M121- Chapter 1- Lab - $match Error while running aggregation and load function

Hi All, I’m on M121 Chapter 1 lab for $match aggregation operator, I see the attached error if i try to verify the aggregation I’ve run using db.movies.aggregate(pipeline).itcount(). Has anyone come across this please? I see error with the load function as well which is the next step to this.

You are using mongosh rather than mongo.

Thanks Steevej, Does it mean it will never work or there is different syntax for mongosh?

Mongosh is in development. I am not too sure about its evolution. Since the course is built mongo, I think it is best to use it. You may add a https://docs.mongodb.com/manual/reference/operator/aggregation/count/ stage to verify the count with mongosh, that should work.

I switched to mongo shell from an mongo community software version and got this working now.

Thanks for your inputs.

Cheers.

1 Like