Code:
FirebaseUser firebaseKullanici = yetki.getCurrentUser();
String kullaniciId = firebaseKullanici.getUid();
yol = FirebaseDatabase.getInstance().getReference().child("Kullanıcılar").child("KullaniciId");
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("id", kullaniciId);
hashMap.put("kullaniciAdi", kullaniciAdi.toLowerCase());
hashMap.put("adsoyad", adsoyad);
hashMap.put("bio", "");
hashMap.put("resimurl", "https://firebasestorage.googleapis.com/v0/b/uygulama-4683b.appspot.com/o/placeholder-user-scaled.jpg?alt=media&token=29e7ea5c-3d37-4d06-a119-badbf3fe944b");
How can I fix this?
You're getting that schema inside the database because of the "Kullanıcılar" hard-coded value that is passed to the .child("Kullanıcılar")
function and because of the call of .child("KullaniciId")
. If you want your database to look like this, then please change this line:
yol = FirebaseDatabase.getInstance().getReference().child("Kullanıcılar").child("KullaniciId");
To:
yol = FirebaseDatabase.getInstance().getReference().child(KullaniciId);
See, I have removed the call to .child("Kullanıcılar")
and removed the quotes inside .child(KullaniciId)
?
Edit:
If you want to group all users within a "users" node for example, then you have to add a call to .child("users")
like below:
yol = FirebaseDatabase.getInstance().getReference()
.child("users"); //👈
.child(KullaniciId);