Some time ago, Firebase introduced a new database called Firestore. I am trying to migrate my project's Realtime database to the new one. One of the drawbacks in the Realtime database is that it doesn't allow query on multiple fields. As far as I understand, the same applies for Firestore (more or less). But, I am trying to understand if it is possible to filter on multiple values inside of a property which is of type Map.
For example,
field1: "Some string"
field2: "456"
field3: {
"key1":"value1",
"key2":"value2"
}
Here, it is possible to execute compound queries as explained here.
So, I could execute:
let query = ref.where('field1', '==', 'Some string').where('field2', '==', '456');
But, how can I achieve the same with regard to the properties inside field3?
To compare subfields, use dot notation.
So:
let query = ref.where('field3.key1', '==', 'value1')
.where('field3.key2', '==', 'value2');