因此,当我想在Firebase数据库的不同点上写多个值时,我会使用HashMap。这是一个例子:
HashMap<String, Object> friendsMap = new HashMap<>();
friendsMap.put("TABLE_1/" + currentUser.getUid() + "/" + displayingUser + "/date", currentDate);
friendsMap.put("TABLE_1/" + displayingUser + "/" + currentUser.getUid() + "/date", currentDate);
friendsMap.put("TABLE_2/" + currentUser.getUid() + "/" + displayingUser, null);
friendsMap.put("TABLE_2/" + displayingUser + "/" + currentUser.getUid(), null);
mRootRef.updateChildren(unFriendMap,...);
有没有办法实现与查询类似的东西?
我可以单独运行它们但是我会失去性能。
Query query = mRootRef.child("TABLE_1").orderByChild("some_value").equalTo("something");
Query query2 = mRootRef.child("TABLE_2").orderByChild("some_other_value").equalTo("something_else");