In Firebase when searching for a username (or anything search related for that matter) what is the difference between
.queryOrdered().queryEqual(toValue:
and child().observeSingleEvent(
I looked at the answer and comments below from @Frank van Puffelen
In these comments he says to use:
reference.child("usernames").child(usernameYourSearchingFor).observeSingleEvent(of: .value, with: { (snapshot) in
if snapshot.exists() { ... } else { ... }
})
But in this answer he answered with:
ref.child("users").queryOrdered(byChild:"username").queryEqual(toValue: usernameYourSearchingFor).observeSingleEvent(of: .value, with: { snapshot in
if snapshot.exists() { ... } else { ... }
})
When searching the database using either of these methods, is there a difference between speed and efficiency, or is it simply a matter of using 2 different methods to achieve the same exact goal?