0

I'm trying to filter my posts such that I only get the ones that have time that is in the future and that don't include the users posts. So my code is:

func fetchAllPosts() async throws -> [Post] {
  try await fetchPosts(from: postsReference.whereField("time", isGreaterThan: Date()).whereField("author.id", isNotEqualTo: user.id))
}

However when I run the code I get this error:

Thread 2: "Invalid Query. All where filters with an inequality (notEqual, lessThan, lessThanOrEqual, greaterThan, or greaterThanOrEqual) must be on the same field. But you have inequality filters on 'time' and 'author.id'".

So does this mean that there is no way to filter my posts using inequality filters that work on two or more fields?

Thanks!

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
Eyan Yehya
  • 33
  • 4
  • That is not supported atm. Best workaround would be to filter on one field using query and the rest on client as mentioned in the linked answers. – Dharmaraj Oct 04 '22 at 15:13

0 Answers0