Models with one-to-many connections are lazy-loaded when accessing the connected property, so accessing a relation is as simple as:

<BlockSwitcher>

<Block name="Async/Await">

```swift
do {
    guard let queriedPost = try await Amplify.DataStore.query(Post.self, byId: "123"),
            let comments = queriedPost.comments else {
        return
    }
    // call fetch to lazy load the postResult before accessing its result
    try await comments.fetch()
    for comment in comments {
        print("\(comment)")
    }
} catch let error as DataStoreError {
    print("Failed to query \(error)")
} catch let error as CoreError {
    print("Failed to fetch \(error)")
} catch {
    print("Unexpected error \(error)")
}
```

</Block>

<Block name="Combine">

```swift
let sink = Amplify.Publisher.create { try await Amplify.DataStore.query(Post.self, byId: "123") }.sink {
    if case let .failure(error) = $0 {
        print("Error retrieving post \(error.localizedDescription)")
    }
} receiveValue: { queriedPost in
    guard let queriedPost = queriedPost,
            let comments = queriedPost.comments else {
        return
    }
    // call fetch to lazy load the postResult before accessing its result
    Task {
        do {
            try await comments.fetch()
            for comment in comments {
                print("\(comment)")
            }
        } catch let error as CoreError {
            print("Failed to fetch \(error)")
        } catch {
            print("Unexpected error \(error)")
        }
    }
}
```

</Block>

</BlockSwitcher>

The connected properties are of type `List<M>`, where `M` is the model type, and that type is a custom [Swift Collection](https://developer.apple.com/documentation/swift/collection), which means that you can `filter`, `map`, etc:

```swift
let excitedComments = comments
    .compactMap { $0.content }
    .filter { $0.contains("Wow!") }
```
