E QUERY [thread1] SyntaxError: invalid property id @(shell)

I have “MongoDB in Action” book, In aggregation chapter,
I have the following codes:
product = db.products.find({'slug': 'wheel-barrow-9092'})
ratingSummary = db.reviews.aggregate([ {$match: {product_id : product['_id'] }},{$group: {_id: '$product_id',{average: '$rating'},count: {$sum: 1} }} ]).next();

But I get the following error:
2021-06-24T17:24:46.311+0430 E QUERY [thread1] SyntaxError: invalid property id @(shell):1:109

Most likely, the braces are wrong in the following:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.