【发布时间】:2020-02-01 09:43:36
【问题描述】:
sportsRef.collection("sports").documents [
["bowling" : [
"equipment": "bowling ball, bowling alley, bowling shoes",
"description": "bowl the ball" ]]
["football": [
"equipment": "ball, boots, shin pads, goalie gloves",
"description": "kick the ball in the goal" ]]
["darts": [
"equipment": "darts, dartboard",
"description": "throw the dart at the board" ]]
["boxing": [
"equipment": "boxing gloves, ring",
"description": "punch your contender" ]]
["shot put": [
"equipment": "shot put",
"description": "throw the shot put, looks like a ball" ]]
]
db.collectionGroup("sports").whereField("description", [i don't know what to
put]).get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>(){
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots){
//...
}
});
有没有一种可能的方法可以查询字段“描述”的所有值?
【问题讨论】:
-
我不清楚您要完成什么。 “查询字段的所有值”到底是什么意思?您是否阅读过查询 Firestore 的文档? firebase.google.com/docs/firestore/query-data/queries
-
抱歉用词不当。我想获取“描述”字段中的所有值。
-
看起来你只有一个值——一个字符串?你想用它做什么?你试过什么?
-
我想将这些值存储在一个数组中:投球,将球踢进球门,将飞镖扔到板子上,打你的竞争者,投掷铅球,看起来像一个球。
-
好的,你试过什么?请编辑您的问题以显示您的代码以及您遇到的问题。
标签: android google-cloud-firestore