Sharing a list of items

If I share a list of items (item group) with others, I could use ItemGroup.id to synchronize the item group, but that won’t automatically synchronize the individual items.

/// An individual item. Part of an `ItemGroup`.
final class Item: Object, ObjectKeyIdentifiable {
    @Persisted(primaryKey: true) var _id: ObjectId
    
    @Persisted var name = "\(randomAdjectives.randomElement()!) \(randomNouns.randomElement()!)"

    /// The backlink to the `ItemGroup` this item is a part of.
    @Persisted(originProperty: "items") var group: LinkingObjects<ItemGroup>
    
    /// Store the user.id as the ownerId so you can query for the user's objects with Flexible Sync
    /// Add this to both the `ItemGroup` and the `Item` objects so you can read and write the linked objects.
    @Persisted var ownerId = ""
}

/// Represents a collection of items.
final class ItemGroup: Object, ObjectKeyIdentifiable {
    /// The unique ID of the ItemGroup. `primaryKey: true` declares the
    /// _id member as the primary key to the realm.
    @Persisted(primaryKey: true) var _id: ObjectId
    
    /// The collection of Items in this group.
    @Persisted var items = RealmSwift.List<Item>()
    
    /// Store the user.id as the ownerId so you can query for the user's objects with Flexible Sync
    /// Add this to both the `ItemGroup` and the `Item` objects so you can read and write the linked objects.
    @Persisted var ownerId = ""
}

I am not sure about the efficiency of @Persisted(originProperty: "items") var group: LinkingObjects<ItemGroup>. Is it searching items of all item groups?

If I use Item.group to synchronize, I am concerned it will search the entire database of all users.

let sharedGroups: [ItemGroup] = [] // attached to user
for group in sharedGroups {
    subs.append(QuerySubscription<ItemGroup>(name: "group-\(group.id)") {
        $0._id == group._id
    })
    
    subs.append(QuerySubscription<Item>(name: "items-\(group.id)"){
        $0.group._id == group._id
    })
}