node.js - How can I update inner data with specific id in firebase -


i trying update node under promo id between apply , trigger location in firebase. it's not update same location name exists. it's disturb ordering after update name. have tried method withupdate() fail. setwithprority() remove other nodes(apply , trigger) , add name node after update name.note data exist in firebase update name.

my script:

firebase.database().ref('/promotions/v1/' + site + '/'+ promoid).once('value').then(function (snapshot) {   promo_data = snapshot.val();   if (promo_data != null) {     var refss = firebase.database().ref('/promotions/v1/' + site + '/'+ promoid );     refss.child('/').update({"name":promorulename});   } }); 

my output! enter image description here
note: have not trigger , apply node.i have promorulename string.

expected output!

enter image description here.

please help

thanks in advance!

the ordering see in console based on "priority-then-key". since called setwithpriority() natural/alphabetical ordering disturbed. highly recommend not calling setwithpriority() anymore, method relic past before firebase supported orderbychild().

to fix problem current data, you'll need delete priority node(s) have it. in sample data shared can accomplished with:

firebase.database().ref('/promotions/v1/22516/46/name').setpriority(null); 

also see: what priority mean in firebase?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -