我的收藏如下:
-products
-productID
-category [object]
catitem1 - boolean
catitem2 - boolean
this.afs.collection<Product>('products', ref =>
ref
.where(`category.${categoryName}`, '==', true)
.limit(limit)
);
这个查询工作正常,但是当我向上面的查询添加orderBy时,我被要求创建一个
index
对于查询。
this.afs.collection<Product>('products', ref =>
ref
.where(`category.${categoryName}`, '==', true)
.orderBy('createdDate','desc')
.limit(limit)
);
categoryName
可以创建并且可以随时更改,我应该为每个categoryName添加索引,每个categoryName将以数百为单位。
有什么方法可以为创建通配符索引
category.categoryName
?
我试着用
category.*