1

In MongoDB if I run a query like the following to get the latest trade:

db.trades.find({ sym: 'AAPL' }).sort({ d: -1 }).limit(1)

If the index on d is created as { d: 1 }. I.E. does it matter if the index sort is ascending or descending? Also, I have an index on sym as well { sym: 1 }.

Justin
  • 42,716
  • 77
  • 201
  • 296
  • 1
    Possible duplicate of [Why does direction of index matter in MongoDB?](https://stackoverflow.com/questions/10329104/why-does-direction-of-index-matter-in-mongodb) – kmdreko Feb 25 '19 at 20:01
  • Also possible duplicate of https://stackoverflow.com/questions/36142299/how-does-sorting-with-an-index-work-in-mongodb/36420196#36420196 – kevinadi Feb 26 '19 at 02:47

0 Answers0