I have my collection created as below:
-products
-productID
-category [object]
catitem1 - boolean
catitem2 - boolean
now I have written a query as below
this.afs.collection<Product>('products', ref =>
ref
.where(`category.${categoryName}`, '==', true)
.limit(limit)
);
This query works fine but when I add orderBy to the above query, I am asked to create an index
for the query.
this.afs.collection<Product>('products', ref =>
ref
.where(`category.${categoryName}`, '==', true)
.orderBy('createdDate','desc')
.limit(limit)
);
Since the categoryName
can be created and can be changed at anytime, I am supposed to add indexing for each and every categoryName which would be in hundreds.
Is there any way where I can create a wildcard index for category.categoryName
?
I tried using category.*
but that's not acceptable. Hope to find some help here.