I am working on Forgot Password which requests guest to enter their phone number then receive an SMS. once SMS verified, then he/she can reset password. When guest enter the mobile number, I want to do a query where I first see if the number exist as value in mobile column in the user table.
The best way I think to do this is to do a query with a where clause but it is really not very clear how to do it here. I found the below sample but unable to modify it to do the job:
func fetchingUsersAsync() {
let dataStore = self.backendless.persistenceService.of(BackendlessUser.ofClass())
dataStore.find(
{ (users : BackendlessCollection!) -> () in
print("Users have been fetched (ASYNC): \(users)")
},
error: { ( fault : Fault!) -> () in
print("Server reported an error (ASYNC): \(fault)")
}
)
}
func findContactWhereAgeMore21() {
let whereClause = "age > 21"
let dataQuery = BackendlessDataQuery()
dataQuery.whereClause = whereClause
var error: Fault?
let bc = backendless.data.of(Contact.ofClass()).find(dataQuery, fault: &error)
if error == nil {
print("Contacts have been found: \(bc.data)")
}
else {
print("Server reported an error: \(error)")
}
}
yes I did look at that earlier but it is not querying Users table and I believe user table would probably have a different way. Beside when I use the above, I don’t have a class called Contact and when I replace it with User it still highlights as error.