Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Swift Firebase querying

Latcie:

I am trying to grab the uid given his Email.

I have this:


let usersRef = Database.database().reference().child("users")

usersRef.queryOrdered(byChild: "email").queryStarting(atValue: email).queryEnding(atValue: email).observeSingleEvent(of: .value, with: { (snapshot) in
if let values = snapshot.value as? [String: Any]{
print(values)
}
})

And my database looks as follows:

users

| -$uid

| --email: "some email"

The Snapshot doesn't return anything.

Also, the debugger tells me this: Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ".indexOn": "email" at /users to your security rules for better performance

I think I have done this like so:


{
"rules": {
"users": {
".read": "auth != null",
"$uid": {
".write": "$uid === auth.uid",
".indexOn": ["email"]
}

But this doesn't work as well.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Swift Firebase querying

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×