在实时数据库中的不同节点中搜索

时间:2017-03-05 12:02:46

标签: json search firebase firebase-realtime-database

假设我有一个示例Firebase实时数据库,如下所示:

void insertEvent(String summary, String location, String des, DateTime startDate, DateTime endDate, EventAttendee[] eventAttendees) throws IOException {
    Event event = new Event()
            .setSummary(summary)
            .setLocation(location)
            .setDescription(des);     EventDateTime start = new EventDateTime()
            .setDateTime(startDate)
            .setTimeZone(“America/Los_Angeles”);
    event.setStart(start);     EventDateTime end = new EventDateTime()
            .setDateTime(endDate)
            .setTimeZone(“America/Los_Angeles”);
    event.setEnd(end);     String[] recurrence = new String[] {“RRULE:FREQ=DAILY;COUNT=1”};
    event.setRecurrence(Arrays.asList(recurrence));     event.setAttendees(Arrays.asList(eventAttendees));     EventReminder[] reminderOverrides = new EventReminder[] {
            new EventReminder().setMethod(“email”).setMinutes(24 * 60),
            new EventReminder().setMethod(“popup”).setMinutes(10),
    };
    Event.Reminders reminders = new Event.Reminders()
            .setUseDefault(false)
            .setOverrides(Arrays.asList(reminderOverrides));
    event.setReminders(reminders);     String calendarId = “primary”;
    //event.send
if(mService!=null)
      mService.events().insert(calendarId, event).setSendNotifications(true).execute();
}

节点用户所在的位置,跟踪已签名的用户及其名称。如果用户ABC发帖,帖子将插入到Feed节点中。

发布后,我需要使用uid知道名称。 我可以使用XYZDBName: { users: { uid1: { name: "ABC" } uid2: { name: "XYZ" } } feeds: { postid: { content: "Hello" madeby: "ABC" } } } 获取uid, 但是如何遍历用户节点以匹配它呢?

0 个答案:

没有答案