Hi. In the icecream_data, I am trying to write a query that allows me to see ONLY the month and the icecream_sales_in_millions sorting on the latter in an descending order. I have tried to write in so many way. The following query doesn’t issue anu error, YET, it doesn’t do what I want! Why??
db.icecream_data.aggregate([
{"$project": {
_id:0,
"trends.month": 1,
"trends.icecream_sales_in_millions": 1}
},
{$sort: {
"trends.icecream_sales_in_millions": -1
}}
]).pretty()
Thanks for your help!
Rhonda