Firebase等效于以下mysql查询

时间:2017-02-15 18:48:25

标签: firebase firebase-realtime-database

我有以下三个SQL表(在MySQL中):

Users
+---------+------+
| user_id | name |
+---------+------+
| user_1  | John |
+---------+------+
| user_2  | Jane |  
+---------+------+

Places
+-----------+----------+
| places_id | name     |
+-----------+----------+
| places_1  | KFC      |
+-----------+----------+
| places_2  | Starbuck |
+-----------+----------+
| places_3  | Subway   |
+-----------+----------+

UserLikes
+---------+-----------+----------+
| user_id | places_id | liked    |
+---------+-----------+----------+
| user_1  | places_1  | yes      |
+---------+-----------+----------+
| user_1  | places_2  | no       |
+---------+-----------+----------+
| user_2  | places_1  | yes      |
+---------+-----------+----------+

这是我用来获取user_1不喜欢或不喜欢的地方的查询。

  

SELECT * FROM Places WHERE places_id NOT IN(SELECT places_id FROM   UserLikes WHERE user_id ='user_1')

我需要一个与上面的查询等效的Firebase查询。你会如何在Firebase中执行此逻辑?

感谢。

0 个答案:

没有答案