如何以json格式访问firebase数据库值

时间:2018-04-03 10:59:37

标签: javascript json firebase firebase-realtime-database google-cloud-functions

我的JSON结构如下 - :

[how can i access this json structure for firebase realtime db, basically i want to print 
    id(numeric num), then the email_id][1]


  https://i.stack.imgur.com/UslTG.png

我想读取数值和电子邮件,每次数字值都会改变,我想读取文章中最新添加的值/。?

1 个答案:

答案 0 :(得分:0)

如何检索id(数字 - 也没有读取该数字的键)和电子邮件

INSERT INTO `app_posts` VALUES (1,405,'First comments','2018-03-31 01:11:31','2018-03-31 01:11:31',1),(2,405,'jjjjjjjjjjjj','2018-03-31 01:15:58','2018-03-31 01:15:58',1),(3,405,'Testinggggggggggggggg','2018-03-31 01:21:18','2018-03-31 01:21:18',1),(4,405,'tttttttttttttttt','2018-03-31 01:43:14','2018-03-31 01:43:14',1),(5,405,'sdfgsdfgsdfgd','2018-04-02 07:26:21','2018-04-02 07:26:21',1),(6,405,'asdfasd','2018-04-02 07:27:24','2018-04-02 07:27:24',1),(7,405,'xczvxcv','2018-04-02 07:27:55','2018-04-02 07:27:55',1),(8,405,'sdfsdf','2018-04-02 01:44:42','2018-04-02 01:44:42',1);
INSERT INTO `app_post_likes` VALUES (1,5,405,'2018-04-02 07:26:27','2018-04-02 07:26:27',0),(2,6,405,'2018-04-02 07:27:29','2018-04-02 07:27:29',0),(3,7,405,'2018-04-02 07:28:00','2018-04-02 07:28:00',0),(4,1,405,'2018-03-04 12:25:54','2018-04-02 11:22:25',0),(5,1,405,'2018-03-04 12:25:54','2018-04-02 11:22:25',0),(6,1,405,'2018-03-04 12:25:54','2018-04-02 11:22:25',0),(7,1,405,'2018-03-04 12:25:54','2018-04-02 11:22:25',0),(8,1,405,'2018-03-04 12:25:54','2018-04-02 11:22:25',0),(9,5,405,'2018-03-04 12:25:54','2018-04-02 11:22:25',0),(10,7,405,'2018-03-04 12:25:54','2018-04-02 11:22:25',0),(11,5,404,'2018-03-02 14:02:02','2018-03-02 14:02:02',0),(12,3,405,'2018-04-02 01:42:20','2018-04-02 01:42:20',0),(13,2,405,'2018-04-02 01:42:24','2018-04-02 01:42:24',0),(14,8,405,'2018-04-02 01:44:56','2018-04-02 01:44:56',0);
INSERT INTO `app_post_files` VALUES (1,'User2.jpeg',0,1),(2,'images.jpg',0,1),(3,'images.jpg',0,2),(4,'User2.jpeg',0,3),(5,'images.jpg',0,3),(6,'images.jpg',0,4),(7,'User2.jpeg',0,5),(8,'User2.jpeg',0,6),(9,'images.jpg',0,6),(10,'User2.jpeg',0,7),(11,'User2.jpeg',0,8);
INSERT INTO `app_post_comments` VALUES (1,'afasdf',5,405,'2018-04-02 07:26:44','2018-04-02 07:26:44',0),(2,'asdfasdf',5,405,'2018-04-02 07:26:47','2018-04-02 07:26:47',0),(3,'zxcvzxcv',6,405,'2018-04-02 07:27:32','2018-04-02 07:27:32',0),(4,'zxcvzxcv',6,405,'2018-04-02 07:27:34','2018-04-02 07:27:34',0),(5,'xcvbxcvb',7,405,'2018-04-02 07:28:15','2018-04-02 07:28:15',0),(6,'xcvbxcvb',7,405,'2018-04-02 07:28:17','2018-04-02 07:28:17',0),(7,'xcvbxcvb',7,405,'2018-04-02 07:28:19','2018-04-02 07:28:19',0),(8,'xcvbxcvb',7,405,'2018-04-02 07:28:23','2018-04-02 07:28:23',0),(9,'sdfsdf',2,405,'2018-04-02 01:43:27','2018-04-02 01:43:27',0),(10,'',2,405,'2018-04-02 01:43:29','2018-04-02 01:43:29',0),(11,'sdfsd',1,405,'2018-04-02 01:43:36','2018-04-02 01:43:36',0);

更多信息请参阅:https://firebase.google.com/docs/database/web/read-and-write