Reputation: 60
export const structuredQuery = {
"from": [{
"collectionId": "products",
"allDescendants": false
}],
"where": {
"fieldFilter": {
"field": {
"fieldPath": "name"
},
"op": "EQUAL",
"value": {
"stringValue": "test"
}
}
}
};
above is the sample structured query which I have right now, here I need to add "category" as new condition (like name).
please any one help me on this.
Upvotes: 1
Views: 835
Reputation: 386
You can use use a CompositeFilter as they give the option to query on more than one field. Just keep in mind that if you order the query it shall be on the first fiel of the filter.
export const structuredQuery = {
"from": [{
"collectionId": "products",
"allDescendants": false
}],
"where": {
"compositeFilter": {
"op": "AND",
"filters": [{
"fieldFilter": {
"field": {
"fieldPath": "name"
},
"op": "EQUAL",
"value": {
"stringValue": "test"
}
}
}]
}
}
};
Upvotes: 6