我正在尝试使用firebase查询从firebase数据库获取数据
curl
当我将此查询传递给firebase并打印snapshot.value时,我按照以下命令获取firebase中存在的顺序数据
self.getReferencePath().child(User.followingReferencePath).queryOrderedByKey().queryLimited(toLast: 5)
但是在将snapshot.all值转换为NSArray之后,订单会更改如下
snapshot.value {
"-L2_hNtqB5UCBzgMFX0m" = {
"debate_id" = "-L2_hNtqB5UCBzgMFX0m";
};
"-L2_hSQSl7T5cDCfDoiV" = {
"debate_id" = "-L2_hSQSl7T5cDCfDoiV";
};
"-L2_h_vrwqID5Esl6gOk" = {
"debate_id" = "-L2_h_vrwqID5Esl6gOk";
};
"-L2_hfAruruMjzrLEZtI" = {
"debate_id" = "-L2_hfAruruMjzrLEZtI";
};
"-L2_hk2Uq7IBcflkO5YQ" = {
"debate_id" = "-L2_hk2Uq7IBcflkO5YQ";
};
}
我希望得到最后一个Id as = nd将其传递给另一个查询。随着订单的变化,我无法正确获取最后一个ID。请告知如何在不更改订单的情况下获取数据,并且还要从我获得的快照中获取最后一个ID。提前致谢