how to modiify an existing record in realm in javascript

Viewed 2582

I want to update values in an existing data for a particular schema

class Car {}
Car.schema = {
  name: 'Car',
  properties: {
    make:  'string',
  }
};
let realm = new Realm({schema: [Car,]});
realm.write(() => {
  let myCar = realm.create('Car', {
    make: 'Ford',
    model: 'Focus',
    miles: 2000,
  });
});
realm.write(() => {
  let myCar = realm.create('Car', {
    make: 'Ford',
    model: 'Focus',
    miles: 2000,
  });
});
realm.write(() => {
  let myCar = realm.create('Car', {
    model: 'Focus',
  });
})

Now If i want to update this 'model' property out of several records, how can I do it.

1 Answers
Related