Firebase数据库查询问题

时间:2020-10-27 19:01:05

标签: python firebase-realtime-database pyrebase

我有一个使用Python库Pyrebase设置的Firebase实时数据库。我正在尝试查询数据库以查找匹配的值。我的问题是我正在使用的查询不返回任何值,只是空括号。这是我用来检查匹配值func getTimeline(for configuration: SelectAccessoryIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> ()) { // id stores the uuid of the accessory that was chosen by the user using the dynamic Intent if let id = configuration.accessory?.identifier { // Step 2.: fetch the accessory // hm is a HMHomeManager let hm = HomeStore.shared.homeManager // take a short nap until the connection to the local HomeKit instance is established (otherwise hm.homes will create an empty array on first call) sleep(1) let accessories = hm.homes.flatMap({ h in h.accessories }) if let a = accessories.filter({ a in a.uniqueIdentifier.uuidString == id }).first { // a holds our HMAccessory // Step 3.: select the characteristic I want // obviously the real code chooses a specific characteristic let s: HMService = a.services.first! let c: HMCharacteristic = s.characteristics.first! // Step 4.: read the characteristic's value c.readValue(completionHandler: {err in if let error = err { print(error) } else { print(c.value ?? "nil") } // complete with timeline completion(Timeline(entries: [RenderAccessoryEntry(date: Date(), configuration: configuration, value: c.value)], policy: .atEnd)) }) } } } } 的查询。我似乎无法发现问题,我用readValue打印了整个数据库,它工作得很好。还要检查以确保传递了有趣的result = db.child("Users").order_by_child("Userid").equal_to( mUserID ).get()中的值,所以我不确定为什么只返回空括号,有什么想法吗?

下面是代码和数据库截图以及规则。

db.child("Users").get()

enter image description here

getID()

0 个答案:

没有答案