Updating Array Objects in Realm

Viewed 3718

I have a realm Organization and Ticket. An organization has many tickets. So to update organization, it looks like this:

    try {
        realm.write(() => {
            realm.create('Organization', { 
                id: organization.id,
                name: organization.name,
                ticket: downloadTickets(organization.id)
            }
            , true)
        })
        console.log("inserting/updating ogranization")
    } catch(err) {
        console.warn(err)
    }

The downloadTickets function returns an array of objects. This will work on my initial write. But if I want to update the array, I want to add objects to the array but not overwrite the whole array. How can I do this without getting the current values, appending it to the new ones, and returning it to the object? That seems too slow.

1 Answers
Related