2

I am querying users from Firebase and would like to know the best method to query all users excluding the current ref.authData.uid . In parse its read like this......

query?.whereKey("username", notEqualTo: PFUser.currentUser()!.username!)
query?.whereKey("username", containsString: self.searchTXTFLD.text)

Also, is there any Firebase query type similar to Parse's containsString?

Charles Jr
  • 8,333
  • 15
  • 53
  • 74
  • As Frank says in his answer, there is no searching within a string. However, you can roll your own [Searching in Firebase without server side code](http://stackoverflow.com/questions/33867185/searching-in-firebase-without-server-side-code/33881832#33881832). See my answer there. As far as omitting the current user, there are ways to do that but it depends on if you are doing a query or observing the node. If we had more data as to what you are after, we can provide better direction. – Jay Mar 07 '16 at 22:51

1 Answers1

3

There is no way to retrieve only items from Firebase that don't match a certain condition. You'll have to retrieve all items and exclude the offending ones client-side. Also see is it possible query data that are not equal to the specified condition?

There is also no contains operator for Firebase queries. This has been covered many times before, such as in this question: Firebase query - Find item with child that contains string

Community
  • 1
  • 1
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807