In addition to performing simple fetches for our Firestore Documents, we can also provide filtering during the retrieval process. In this lesson, I'll go over a couple of useful techniques for querying data based on some criteria such as name, age, friends. I'll also go over some useful syntactical improvements we can use for User conversion.

Comments (9)
Prabhdeep Singh Randhawa
4 years ago
2018-11-18 19:02:07.496810+1300 Tinder[4768:49385] 5.2.0 - [Firebase/Firestore][I-FST000001] The behavior for system Date objects stored in Firestore is going to change AND YOUR APP MAY BREAK. To hide this warning and ensure your app does not break, you need to add the following code to your app before calling any other Cloud Firestore methods: let db = Firestore.firestore() let settings = db.settings settings.areTimestampsInSnapshotsEnabled = true db.settings = settings With this change, timestamps stored in Cloud Firestore will be read back as Firebase Timestamp objects instead of as system Date objects. So you will also need to update code expecting a Date to instead expect a Timestamp. For example: // old: let date: Date = documentSnapshot.get("created_at") as! Date // new: let timestamp: Timestamp = documentSnapshot.get("created_at") as! Timestamp let date: Date = timestamp.dateValue() Please audit all existing usages of Date when you enable the new behavior. In a future release, the behavior will be changed to the new behavior, so if you do not follow these steps, YOUR APP MAY BREAK.
Prabhdeep Singh Randhawa
4 years ago
hi Brian , the console is showing this warning.
Prabhdeep Singh Randhawa
4 years ago
disregard that .I think I was in to hurry to post the comment.
Brian Voong
4 years ago
Cinquain
4 years ago
That video was fire!
Daniel Peach
4 years ago
Such a sad limitation to queries:( This is still the case it seems.
Paweł Liczmański
4 years ago
yeah its bad that we cant make something like .whereField("Username", contains: "An") and get Anna, Andy etc. :/
Brian Voong
4 years ago
jorgelub12
4 years ago
You also can fix the bug by adding if imagesNames.count == 1 { return } in advanceToNextPhoto / goToPreviousPhoto methods. Keep going !
nick1234
4 years ago
Great video, I am working on trying to figure out how to query using gender but can't seem to get it to work. Any tips on where I could start?
Brian Voong
4 years ago
nick1234
4 years ago
Would you include it along with the min/maxAge whereFields? Or should I create another line for the filter? Thanks!
Brian Voong
4 years ago
Eugeneberezin
4 years ago
Speaking about bugs. Now when the home page opens it flashes the most recent user that was registered and then presents a different user. The most recent user is at the end of the stack.
HELP & SUPPORT