# Linked collections

Source: https://developers.swell.is/backend-api/updating/linked-collections

When updating a record that links to another collection, the values of records in that collection can be updated in the same request by passing their IDs, along with the fields and new values.

For example, the code below will update a customer's phone number for three of their addresses in a single request, as the `addresses` field is a link to the collection `accounts:addresses` and the IDs of each record are specified.

**Update nested records**

**Node**

```javascript
await swell.put('/accounts/{id}', {
  id,
  addresses: [
    { id: '5fc4a1a7a1c964001f451e1a', phone: '999-999-9999' },
    { id: '5fd927d9a1c964001f45215e', phone: '999-999-9999' },
    { id: '6020d206a1c964001f453950', phone: '999-999-9999' },
  ]
})
```

This also works for single linked records. On orders, for example, the `account` field is a link to the `accounts` collection, and the account's `billing.account_card_id` references a record in the `accounts:cards` collection. Say you wanted to change the default card on file for a customer while making other changes to an order — the following code accomplishes that in one request through the order's account link.

**Update nested record**

**Node**

```javascript
await swell.put('/orders/{id}', {
  id,
  account: {
    billing: { 
      account_card_id: '5feb2c50a1c964001f452b4a' 
    },
  }
  ... // Other order record changes
})
```
