[英]How can my NoSQL query be adapted to display the correct outcome? The expected outcome is to display the highest sales rank for Software
我正在按照(1)的方法在產品中找到軟件中最高的銷售排名,如(2)所示,但它似乎不起作用。 在(3)中,它顯示了我如何嘗試對其進行調整。 誰能建議為什么這不起作用?
(1)-我遵循的方法:
db.ads.find({Classification:"Clothes"}, {Manufacturer: 1, Model: 1, Price: 1})
.sort({Price: -1})
.limit(1)
(3)-我如何嘗試適應它但不起作用:
db.my_products.find({mak_salesRank:"Software"}, {Software: 1})
.sort({Software: -1})
.limit(1)
試試這個。
db.my_products.find({}, {"mak_salesRank": 1})
.sort({"mak_salesRank.Software": -1})
.limit(1)
如果這不正確,請您顯示預期的結果結構。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.