I want to query search of multiple collections, not just brand. I query directly from cloud firestore
so far I successfully query the brand.
I try to combine also with category and description, but it always fails
I use where() for that to call directly from firebase
getExchanges({commit, state}, {searched} = {searched: ''}) {
commit('resetPagination');
// Here you want to make a call to firebase and ask for data
return db
.collection('exchanges')
.where('brand', '>=', searched).where('brand', '<=', searched+ '\uf8ff')
.limit(state.pagination.itemCount)
.get()
.then(snapshots => {
if (snapshots.docs.length === 0) {
commit('setExchanges', []);
return []
}
const exchanges = snapshots.docs.map(doc => ({...doc.data(), id: doc.id}))
commit('setExchanges', exchanges)
commit('setLastItem', snapshots.docs[snapshots.docs.length - 1])
commit('setPreviousFirstItem', snapshots.docs[0])
return exchanges
})
My field in the exchange collection in the firestore is
- brand
- category
- city
With category, i try to do this
.where('brand' || 'category', '>=', searched).where('brand' || 'category', '<=', searched+ '\uf8ff')
Do you have some suggestions? that would be amazing
Cheers
Zaid