Reputation: 5591
I am using angularfire as below:
this.afDB.list('/items/' + this.itemID).push({displayName: item.name});
The structure then looks like this where the itemID
is qoieke
items:
- qoieke:
- Leow9dnfwoierjhwelo
- displayName: "Something"
What I don't understand is how do I avoid getting the "Leow9dnfwoierjhwelo"
as automatically generated id?
So, I want to have structure like below:
items:
- qoieke:
- displayName: "Something"
Thanks!
Upvotes: 0
Views: 414
Reputation: 598887
Calling push
generates a so-called push ID. To not generate that, don't call push. Instead call set()
(to replace the current values at the location with whatever you pass in) or update()
(to only modify the properties you pass in).
In your case an update()
seems to do what you want:
this.afDB.list('/items/' + this.itemID).update({displayName: item.name});
Upvotes: 1