Tag: 分层数据

更有效的方式来检索Firebase数据?

我有一个分层的数据集,我想从Firebase中检索信息。 以下是我的数据看起来如何: 但是,我的问题是这样的:在查看数据的结构如何,当我想要获取attendee的name或object id时,我必须执行以下代码: func getAttendees(child: NSString, completion: (result: Bool, name: String?, objectID: String?) -> Void){ var attendeesReference = self.eventsReference.childByAppendingPath((child as String) + "/attendees") attendeesReference.observeEventType(FEventType.ChildAdded, withBlock: { (snapshot) -> Void in //Get the name/object ID of the attendee one by one–inefficient? let name = snapshot.value.objectForKey("name") as? String let objectID = snapshot.value.objectForKey("objectID") as? String if snapshot […]