Baris
Baris6mo ago

Does withIndex().order().first() scan all documents?

Hi there, I want to use order("desc").first() to get the maximum number from an indexed number column. This table has more than 16k documents. Does ordering scan all the documents?
1 Reply
ian
ian6mo ago
No, the order just determines which side of the index to start from. It should just fetch one document

Did you find this page helpful?