2

I tried:

FirebaseFirestore.instance
        .collection('messages')                  
        .orderBy('sentDate', descending: false)
        .snapshots(), 

but it didn't work.

Firebase Firestore collection/path

1 Answer 1

5

If you want to order by the sendDate of a specific entry in the map you can using dot notation:

.orderBy('167361790.sentDate', descending: false)

If you want to sort on the sentDate of a dynamically selected map entry, that isn't possible with your current data model, and you'll want to modify your data model to allow the use-case.

For example, if you want to order the messages on the most recent sentDate, you should add a top-level field to the document latestSentDate, update that whenever you write to the map, and then sort on that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.