0
我执行以下查询:火力地堡startAt查询给人意想不到的效果
firebase.database().ref().child('files').child('54a8924f8c417b2a281f4e3a4c639785/').orderByChild('path').startAt('54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/')
而且我得到以下输出。这是奇怪的是输出也包含我还没有在路径现场查询这些对象:
[
{
"fullPath": "54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/Test Sub Folder/.Test Sub Folder",
"name": "Test Sub Folder",
"path": "54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/",
"timestamp": 1473150053359,
"type": "dir",
"uid": "ItvFuIIVriaHPPzeMgggwPqSlmq1",
"$id": "-KQy_TcuUb3FsQz-CEyY",
"$priority": null
},
{
"extension": "png",
"fullPath": "54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/download.png",
"mimeType": "image/png",
"name": "download.png",
"path": "54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/",
"size": 124631,
"timestamp": 1473150091860,
"type": "image",
"uid": "ItvFuIIVriaHPPzeMgggwPqSlmq1",
"$id": "-KQy_c1SLjHjTHCS1Mox",
"$priority": null
},
{
"extension": "jpg",
"fullPath": "54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/SampleImage.jpg",
"mimeType": "image/jpeg",
"name": "SampleImage.jpg",
"path": "54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/",
"size": 62678,
"timestamp": 1473150091920,
"type": "image",
"uid": "ItvFuIIVriaHPPzeMgggwPqSlmq1",
"$id": "-KQy_c1WiRELh2GiZoFm",
"$priority": null
},
{
"extension": "jpg",
"fullPath": "54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/goodtimes.jpg",
"mimeType": "image/jpeg",
"name": "goodtimes.jpg",
"path": "54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/",
"size": 128982,
"timestamp": 1473150091920,
"type": "image",
"uid": "ItvFuIIVriaHPPzeMgggwPqSlmq1",
"$id": "-KQy_c1_fNhcg3RKXkTj",
"$priority": null
},
{
"extension": "jpg",
"fullPath": "54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/Test Sub Folder/antibiotics2515.jpg",
"mimeType": "image/jpeg",
"name": "antibiotics2515.jpg",
"path": "54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/Test Sub Folder/",
"size": 430885,
"timestamp": 1473150091921,
"type": "image",
"uid": "ItvFuIIVriaHPPzeMgggwPqSlmq1",
"$id": "-KQy_c1bzYINWTYiyFkC",
"$priority": null
},
{
"extension": "png",
"fullPath": "54a8924f8c417b2a281f4e3a4c639785/Test Folder/download.png",
"mimeType": "image/png",
"name": "download.png",
"path": "54a8924f8c417b2a281f4e3a4c639785/Test Folder/",
"size": 124631,
"timestamp": 1473149727313,
"type": "image",
"uid": "ItvFuIIVriaHPPzeMgggwPqSlmq1",
"$id": "-KQyZDwJIbSExhaln5l-",
"$priority": null
},
{
"extension": "jpg",
"fullPath": "54a8924f8c417b2a281f4e3a4c639785/Test Folder/SampleImage.jpg",
"mimeType": "image/jpeg",
"name": "SampleImage.jpg",
"path": "54a8924f8c417b2a281f4e3a4c639785/Test Folder/",
"size": 62678,
"timestamp": 1473149727363,
"type": "image",
"uid": "ItvFuIIVriaHPPzeMgggwPqSlmq1",
"$id": "-KQyZDwLBEIBKDx6Glq2",
"$priority": null
},
{
"extension": "jpg",
"fullPath": "54a8924f8c417b2a281f4e3a4c639785/Test Folder/goodtimes.jpg",
"mimeType": "image/jpeg",
"name": "goodtimes.jpg",
"path": "54a8924f8c417b2a281f4e3a4c639785/Test Folder/",
"size": 128982,
"timestamp": 1473149728493,
"type": "image",
"uid": "ItvFuIIVriaHPPzeMgggwPqSlmq1",
"$id": "-KQyZDwNTejmqwN6X7ZR",
"$priority": null
},
{
"name": "Test Sub Folder",
"path": "54a8924f8c417b2a281f4e3a4c639785/Test Folder/",
"timestamp": 1473149760565,
"type": "dir",
"uid": "ItvFuIIVriaHPPzeMgggwPqSlmq1",
"$id": "-KQyZLKsDkxlTJHDDwDX",
"$priority": null
},
{
"extension": "jpg",
"fullPath": "54a8924f8c417b2a281f4e3a4c639785/Test Folder/Test Sub Folder/antibiotics2515.jpg",
"mimeType": "image/jpeg",
"name": "antibiotics2515.jpg",
"path": "54a8924f8c417b2a281f4e3a4c639785/Test Folder/Test Sub Folder/",
"size": 430885,
"timestamp": 1473149889432,
"type": "image",
"uid": "ItvFuIIVriaHPPzeMgggwPqSlmq1",
"$id": "-KQyZqbRe3V1BBWImBxq",
"$priority": null
}
]
输出也包括其他的结果,其中path
是“54a8924f8c417b2a281f4e3a4c639785/Test Folder/
”,但我查询了path
开始“54a8924f8c417b2a281f4e3a4c639785/Test Folder 2/
”
非常感谢@vzsg,工作完美。 –