Skip to content

Question 46 / 50

Must KnowMediumDebuggingNode.js

This query became slow after orders reached 50 million documents. What would you investigate?

db.orders.find({
  userId: "64a1b2c3d4e5f6a7b8c90001"
}).sort({
  createdAt: -1
}).limit(20)
Think about it first.