Firebase Firestore索引和查询返回空结果
数据=>categories集合Firebase Firestore索引和查询返回空结果,firebase,google-cloud-firestore,angularfire2,Firebase,Google Cloud Firestore,Angularfire2,数据=>categories集合 [ { "category": "toys and games", "factory": 1, "link": "action-figure-toys-", "name": "action figure toys", "type": "subcategory" }, { "category": "toys and games", "factory": 1, "link": "action
[
{
"category": "toys and games",
"factory": 1,
"link": "action-figure-toys-",
"name": "action figure toys",
"type": "subcategory"
},
{
"category": "toys and games",
"factory": 1,
"link": "action-figure-toys1",
"name": "action figure toys1",
"type": "subcategory"
},
{
"category": "",
"factory": 1,
"link": "action-figure-toys-",
"name": "toys and games",
"type": "category"
},
]
索引
质疑
如果我对where子句进行注释,则查询总是返回空结果!
如果它只有where子句,则返回。
where和startAt的组合导致问题如果删除
startAt
并仅使用where
,它是否返回结果?如果它仅返回where,则部分是。如果orderby在那里,它不会返回任何东西!
{
"collectionId": "categories",
"fields": [
{ "fieldPath": "name", "mode": "ASCENDING" },
{ "fieldPath": "type", "mode": "ASCENDING" },
{ "fieldPath": "factory", "mode": "ASCENDING" },
{ "fieldPath": "category", "mode": "ASCENDING" },
{ "fieldPath": "subCategory", "mode": "ASCENDING" }
]
}
this.db
.collection('categories', ref =>
ref
.where('type', '==', 'category')
.where('factory', '==', 1)
.orderBy('name')
.startAt(this.selected)
.limit(5)
).valueChanges();