i have the following get method
FirebaseFirestore.instance.collection('comments').limit(5)
.orderBy('commentDate',descending: true)
.get(const GetOptions(source: Source.server)).then((value){
//outputs
today
yestrday
oldest
oldest
oldest
});
in previous method i am sorting comments according to the latest .
one of the fields is commentOwnerId : Lx33AN0RwDEWzO7T3xQV
.
Perhaps the owner of the comment is not the most recent , However, I want to show it as a priority over the rest of the documents .
FirebaseFirestore.instance.collection('comments').limit(5)
.orderBy('commentOwnerId ',descending: true) // here i am stack
.orderBy('commentDate',descending: true)
.get(const GetOptions(source: Source.server)).then((value){
//outputs
myComment (yesterday)
today
oldest
oldest
oldest
});
i notice if the commentOwnerId
field is Boolean
instead of string value so it work as expected
but of course i cannot use Boolean
since i need to chick if it was ==
my id or no then descending it to true if it was mine .
How could i handle it ?