GitLiveApp / firebase-kotlin-sdk

A Kotlin-first SDK for Firebase
https://gitliveapp.github.io/firebase-kotlin-sdk/
Apache License 2.0
1.17k stars 155 forks source link

How to query complex list #559

Closed carvalho2707 closed 3 months ago

carvalho2707 commented 4 months ago

With firestore how can query a collection to find if a property( list of objects) has one where a property matches a given string?

Daeda88 commented 4 months ago

The library supports all queries documented in here, with the same kind of restrictions. Syntax is a bit different to make it more kotlin like. From your description it's not entirely clear what you'd want to query, but generally its:

val collectionReference: CollectionReference = // Get a reference to your collection
collectionReference.where {
    NAME_OF_PROPERTY equalTo DESIRED_VALUE
}.get()