how to update an observable value where a key match

Hi guys how can i update an observable where a key match like we do with removeWhere function.

var hotPlaces = Observable(
    {id: "kjazhkj", name: "Oslo", temperature: 30},
    {id: "kjqqdj",name: "New York", temperature: 24},
    {id: "kreerzj",name: "California", temperature: 27},
    {id: "kltrktrj",name: "Sydney", temperature: 10}
)

for exemple with this Observable i would like to update name of the object where the id equal to kjqqdj

You can use refreshAll where you compare the key in compare function.

Already tested , refreshAll only works with arrays , i’m working with one object at time

Hi!

The objects inside observables are not piecewise observable, you have to replace entire objects at a time. Here’s one way:

 for (var i = 0; i < obs.length; i++) {
     if (obs.getAt(i).id === "foo") {
           obs.replaceAt(i, { ... new object ... }
     }
 }