Skip to content

Question 39 / 50

ImportantMediumDebuggingPerformance

Page 1 of this API is fast. Page 5000 is not. Why, and what would you do instead?

db.orders.find({ userId: userId })
  .sort({ createdAt: -1 })
  .skip(page * 20)
  .limit(20)
Think about it first.