I'm making a social media app like instagram, but trying to filter out the user's own posts so they don't see it on their feed. I'm trying to do it like below, but it causes the app to crash. When I change it to .whereEqualTo, it works just fine and only shows posts by the users. As far as I know, the two should work exactly the same, with the obvious exception of it being equal to vs not, so why does one work but the other doesn't?
Does not work
Query query = firestoreDb.collection("posts")
.whereNotEqualTo("user.username", username)
Shows only posts by users
Query query = firestoreDb.collection("posts")
.whereEqualTo("user.username", username)
The error I get is
You have an inequality where filter (whereLessThan(), whereGreaterThan(), etc.) on field 'user.username' and so you must also have 'user.username' as your first orderBy() field, but your first orderBy() is currently on field 'creationTime' instead
but I don't want to order by username.