Update firebase value based on existing value
See original GitHub issueHi , After the update i started having problem updating a value from firebase based on the already exisitng value. so let’s take for example the case of quantity of a specific product.
before i was able to do that :
let item$ = this.af.object('/product/' + productId) item$.take(1).subscribe( item=> { if(item.$exist()) item$.update({ quantity : item.quantity + 1}) })
now with the new API i am having trouble getting that item and updating it in 1 command. Am i missing something ? Hope its not a stupid question but really having all in 1 command solves the issue of having to store locally a “quantity” ( 2 commands : getQuantity and updateQuantity )
Thanks,
Chaker
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
java - Firebase Realtime Database - Updating Existing Value
I want to insert "Cart" value inside "MCwD6C_-XCZNGWxFLhO" user, "Cart" has "itemName","quantity","itemPrice" fields. I tried a lot of ways ...
Read more >Read and Write Data on the Web | Firebase Realtime Database
Generally, you should use the value event techniques described above to read data to get notified of updates to the data from the...
Read more >Update firebase value based on existing value #1342 - GitHub
Hi , After the update i started having problem updating a value from firebase based on the already exisitng value. so let's take...
Read more >How to Update Data in Firebase Firestore in Android?
Step 1: Creating a new Activity for updating the data · Step 2: Updating our Modal Class where we were storing our data...
Read more >Firebase V9 Firestore UPDATE Document Data Using ...
You can also update an existing document field with a new value. Let's change the value of Ontario to ON in the province...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
this my code and it works good, but the problem is that product in set method is undefined! @alberthoekstra
There is still one error showing i.e. Property ‘quantity’ doesn’t exist on ‘{}’ . To resolve this, you have to change item.payload.val().quantity to item.payload.exportVal().quantity. const item$ = this.getItem(cartId, product.key);