我可能错过了什么,因为我还在学习ins和
我有一个Collection ,里面有一系列的名字.
Bottom Round of Beef
Chicken Breast 6oz
Chicken Breast 8oz
Chicken Breast 8oz
Chicken Breast 8oz
Chicken Breast Random
Chicken Legs
Chicken Tenderloin
Chicken Thighs
Kosher Salt
我在"ProductName,_id"上创建了一个复合索引.
我运行以下查询:
db.ProductGuideItem.find( { ProductName: { $gt: "Chicken Breast 8oz" } } ).sort({ProductName:1,_id:1}).limit(3);
请注意,共有3个"鸡胸肉8盎司"项目.
If I run that query I get...
Chicken Breast Random
Chicken Legs
Chicken Tenderloin
如果我在寻呼,从顶部开始.这个问题可能会漏掉
So if each page can only have 3 items and I want to see page 2 then I should see..
Chicken Breast 8oz
Chicken Breast 8oz
Chicken Breast Random.
但我不是.这是最后一块8盎司的鸡胸肉,从那里开始.
Is there a way around this?
Also how would I do this if the list was sorted the opposite way?