vuexfire firestore orderBy descending is not working, works in acending

173 views Asked by At

This code works in default ascending but as soon as I feed desc in orderby, it returns empty.

return bindFirestoreRef(
        'codesBatch',
        codeCollection
          .orderBy('createdOn', 'desc')
          .limit(payload.limit || 3)
          .startAfter(state.loadMoreLastCode || null),
1

There are 1 answers

0
Shreyans Bhansali On

.orderBy() 'desc' doesn't work with .startAfter() null.

The first call has to be without .startAfter() and for later, the above code will work.