Reputation: 117
I would love to eliminate the autogenerated child name of ET which doesnt make sense to me, because i wanted to update a specific item in the branch but i could not navigate into the item because of the autogenerated name, is there anyway to do so?
((Sorry if u find it hard to understand me because i dont really know the official name for this, Let me know what code i should share))
Thanks!
Upvotes: 1
Views: 770
Reputation: 31
That autogenerated name is necesary as identifier of the document. however you can use any value you want, in order to make it more usefull for you. For example (if you are using Firestore) you can use something like this, (if not, the syntax can be different but the idea is the same).
await Firestore.instance
.collection("ET")
.document("Any unique text")
.setData({
"role": "role",
"cluster": "role",
"email": "role",
"name": "role"});
Upvotes: 1
Reputation: 317760
If you don't want a node with a random ID, then don't use push(). It is documented to always use a random ID, so that's what you'll always get.
If you know the name of the node to add instead, then simply build a path using that name chaining calls to child(), then write the data at that location using set().
Upvotes: 1