Minor syntax difference causes missing paginated data

The original working code:

let monthlyPropertyEntry = MonthlyPropertyEntry.byPropertyAndDate(Property(${propertyId}), Date.fromString(${date})).first()!
let roomsSet = MonthlyPropertyRoom.byMonthlyPropertyEntry(monthlyPropertyEntry)
  .map(room=>getRoomFieldsForRoom(room))

monthlyPropertyEntry {
  _id: .id,
  rooms: roomsSet.paginate(1000)
}

The minor change that breaks my expected return value:

et monthlyPropertyEntry = MonthlyPropertyEntry.byPropertyAndDate(Property(${propertyId}), Date.fromString(${date})).first()!
let roomsSet = MonthlyPropertyRoom.byMonthlyPropertyEntry(monthlyPropertyEntry)
roomsSet.map(room => getRoomFieldsForRoom(room))

monthlyPropertyEntry {
  _id: .id,
  rooms: roomsSet.paginate(1000)
}

That difference in either directly chaining the map to the end of the index lookup vs assigning the lookup’s set to a variable first and then mapping it changes whether the paginate calls inside of getRoomFieldsForRoom return data or not

// directly chained result

{
    "data": {
        "_id": "416099581427717632",
        "rooms": {
            "data": [
                {
                    "id": "416099581625894400",
                    "coll": {
                        "@mod": "MonthlyPropertyRoom"
                    },
                    "ts": {
                        "@time": "2024-12-01T19:45:34.655Z"
                    },
                    "revenue": {
                        "data": [
                            {
                                "_id": "416099581665751552",
                                "rentPayment": {
                                    "@int": "175429"
                                },
                                "delinquencyAmount": null,
                                "note": null
                            }
                        ]
                    },
                    "contracts": {
                        "data": []
                    },
                    "monthlyPropertyEntry": {
                        "@doc": {
                            "id": "416099581427717632",
                            "coll": {
                                "@mod": "MonthlyPropertyEntry"
                            },
                            "ts": {
                                "@time": "2024-12-01T19:45:33.898Z"
                            },
                            "year": {
                                "@int": "2024"
                            },
                            "rooms": {
                                "@set": "hdWCxnNNb250aGx5UHJvcGVydHlSb29tgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "revenue": {
                                "@set": "hdWCxngiTW9udGhseVByb3BlcnR5Um9vbVJldmVudWVTdWJpdGVtc4HKhHZieU1vbnRobHlQcm9wZXJ0eUVudHJ5gcZidjD09oHNSgXGSF1eMBYABDD2wYIaZ0y/ChoGjneAEA=="
                            },
                            "expenses": {
                                "@set": "hdWCxnZNb250aGx5UHJvcGVydHlFeHBlbnNlgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "month": {
                                "@int": "12"
                            },
                            "otherRevenue": {
                                "@set": "hdWCxngbTW9udGhseVByb3BlcnR5T3RoZXJSZXZlbnVlgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "targetProperty": {
                                "@ref": {
                                    "id": "416099581287203328",
                                    "coll": {
                                        "@mod": "Property"
                                    }
                                }
                            },
                            "targetDate": {
                                "@date": "2024-12-01"
                            }
                        }
                    },
                    "roomTitle": "402",
                    "status": "HAS_RESIDENT",
                    "variableRentDeclarations": {
                        "data": []
                    },
                    "tenantOutflowAllocations": {
                        "data": []
                    }
                },
                {
                    "id": "416099581846096384",
                    "coll": {
                        "@mod": "MonthlyPropertyRoom"
                    },
                    "ts": {
                        "@time": "2024-12-01T19:45:34.655Z"
                    },
                    "revenue": {
                        "data": [
                            {
                                "_id": "416099581867066880",
                                "rentPayment": {
                                    "@int": "239578"
                                },
                                "delinquencyAmount": null,
                                "note": null
                            }
                        ]
                    },
                    "contracts": {
                        "data": []
                    },
                    "monthlyPropertyEntry": {
                        "@doc": {
                            "id": "416099581427717632",
                            "coll": {
                                "@mod": "MonthlyPropertyEntry"
                            },
                            "ts": {
                                "@time": "2024-12-01T19:45:33.898Z"
                            },
                            "year": {
                                "@int": "2024"
                            },
                            "rooms": {
                                "@set": "hdWCxnNNb250aGx5UHJvcGVydHlSb29tgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "revenue": {
                                "@set": "hdWCxngiTW9udGhseVByb3BlcnR5Um9vbVJldmVudWVTdWJpdGVtc4HKhHZieU1vbnRobHlQcm9wZXJ0eUVudHJ5gcZidjD09oHNSgXGSF1eMBYABDD2wYIaZ0y/ChoGjneAEA=="
                            },
                            "expenses": {
                                "@set": "hdWCxnZNb250aGx5UHJvcGVydHlFeHBlbnNlgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "month": {
                                "@int": "12"
                            },
                            "otherRevenue": {
                                "@set": "hdWCxngbTW9udGhseVByb3BlcnR5T3RoZXJSZXZlbnVlgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "targetProperty": {
                                "@ref": {
                                    "id": "416099581287203328",
                                    "coll": {
                                        "@mod": "Property"
                                    }
                                }
                            },
                            "targetDate": {
                                "@date": "2024-12-01"
                            }
                        }
                    },
                    "roomTitle": "103",
                    "status": "HAS_RESIDENT",
                    "variableRentDeclarations": {
                        "data": []
                    },
                    "tenantOutflowAllocations": {
                        "data": []
                    }
                },
                {
                    "id": "416099581991848448",
                    "coll": {
                        "@mod": "MonthlyPropertyRoom"
                    },
                    "ts": {
                        "@time": "2024-12-01T19:45:34.655Z"
                    },
                    "revenue": {
                        "data": [
                            {
                                "_id": "416099582012818944",
                                "rentPayment": {
                                    "@int": "69300"
                                },
                                "delinquencyAmount": null,
                                "note": null
                            }
                        ]
                    },
                    "contracts": {
                        "data": []
                    },
                    "monthlyPropertyEntry": {
                        "@doc": {
                            "id": "416099581427717632",
                            "coll": {
                                "@mod": "MonthlyPropertyEntry"
                            },
                            "ts": {
                                "@time": "2024-12-01T19:45:33.898Z"
                            },
                            "year": {
                                "@int": "2024"
                            },
                            "rooms": {
                                "@set": "hdWCxnNNb250aGx5UHJvcGVydHlSb29tgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "revenue": {
                                "@set": "hdWCxngiTW9udGhseVByb3BlcnR5Um9vbVJldmVudWVTdWJpdGVtc4HKhHZieU1vbnRobHlQcm9wZXJ0eUVudHJ5gcZidjD09oHNSgXGSF1eMBYABDD2wYIaZ0y/ChoGjneAEA=="
                            },
                            "expenses": {
                                "@set": "hdWCxnZNb250aGx5UHJvcGVydHlFeHBlbnNlgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "month": {
                                "@int": "12"
                            },
                            "otherRevenue": {
                                "@set": "hdWCxngbTW9udGhseVByb3BlcnR5T3RoZXJSZXZlbnVlgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "targetProperty": {
                                "@ref": {
                                    "id": "416099581287203328",
                                    "coll": {
                                        "@mod": "Property"
                                    }
                                }
                            },
                            "targetDate": {
                                "@date": "2024-12-01"
                            }
                        }
                    },
                    "roomTitle": "401",
                    "status": "HAS_RESIDENT",
                    "variableRentDeclarations": {
                        "data": []
                    },
                    "tenantOutflowAllocations": {
                        "data": []
                    }
                },
                {
                    "id": "416099582107191808",
                    "coll": {
                        "@mod": "MonthlyPropertyRoom"
                    },
                    "ts": {
                        "@time": "2024-12-01T19:45:34.655Z"
                    },
                    "revenue": {
                        "data": [
                            {
                                "_id": "416099582117676544",
                                "rentPayment": {
                                    "@int": "231237"
                                },
                                "delinquencyAmount": null,
                                "note": null
                            }
                        ]
                    },
                    "contracts": {
                        "data": []
                    },
                    "monthlyPropertyEntry": {
                        "@doc": {
                            "id": "416099581427717632",
                            "coll": {
                                "@mod": "MonthlyPropertyEntry"
                            },
                            "ts": {
                                "@time": "2024-12-01T19:45:33.898Z"
                            },
                            "year": {
                                "@int": "2024"
                            },
                            "rooms": {
                                "@set": "hdWCxnNNb250aGx5UHJvcGVydHlSb29tgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "revenue": {
                                "@set": "hdWCxngiTW9udGhseVByb3BlcnR5Um9vbVJldmVudWVTdWJpdGVtc4HKhHZieU1vbnRobHlQcm9wZXJ0eUVudHJ5gcZidjD09oHNSgXGSF1eMBYABDD2wYIaZ0y/ChoGjneAEA=="
                            },
                            "expenses": {
                                "@set": "hdWCxnZNb250aGx5UHJvcGVydHlFeHBlbnNlgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "month": {
                                "@int": "12"
                            },
                            "otherRevenue": {
                                "@set": "hdWCxngbTW9udGhseVByb3BlcnR5T3RoZXJSZXZlbnVlgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "targetProperty": {
                                "@ref": {
                                    "id": "416099581287203328",
                                    "coll": {
                                        "@mod": "Property"
                                    }
                                }
                            },
                            "targetDate": {
                                "@date": "2024-12-01"
                            }
                        }
                    },
                    "roomTitle": "300",
                    "status": "HAS_RESIDENT",
                    "variableRentDeclarations": {
                        "data": []
                    },
                    "tenantOutflowAllocations": {
                        "data": []
                    }
                },
                {
                    "id": "416099582200516096",
                    "coll": {
                        "@mod": "MonthlyPropertyRoom"
                    },
                    "ts": {
                        "@time": "2024-12-01T19:45:34.655Z"
                    },
                    "revenue": {
                        "data": [
                            {
                                "_id": "416099582221485568",
                                "rentPayment": {
                                    "@int": "249405"
                                },
                                "delinquencyAmount": null,
                                "note": null
                            }
                        ]
                    },
                    "contracts": {
                        "data": [
                            {
                                "_id": "416099585670258176",
                                "contractStartDate": {
                                    "@date": "2023-08-04"
                                },
                                "contractEndDate": {
                                    "@date": "2025-09-13"
                                },
                                "tenant": {
                                    "_id": "416099585565403648",
                                    "tenantName": "山口 悠斗"
                                },
                                "hasVariableRent": true
                            }
                        ]
                    },
                    "monthlyPropertyEntry": {
                        "@doc": {
                            "id": "416099581427717632",
                            "coll": {
                                "@mod": "MonthlyPropertyEntry"
                            },
                            "ts": {
                                "@time": "2024-12-01T19:45:33.898Z"
                            },
                            "year": {
                                "@int": "2024"
                            },
                            "rooms": {
                                "@set": "hdWCxnNNb250aGx5UHJvcGVydHlSb29tgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "revenue": {
                                "@set": "hdWCxngiTW9udGhseVByb3BlcnR5Um9vbVJldmVudWVTdWJpdGVtc4HKhHZieU1vbnRobHlQcm9wZXJ0eUVudHJ5gcZidjD09oHNSgXGSF1eMBYABDD2wYIaZ0y/ChoGjneAEA=="
                            },
                            "expenses": {
                                "@set": "hdWCxnZNb250aGx5UHJvcGVydHlFeHBlbnNlgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "month": {
                                "@int": "12"
                            },
                            "otherRevenue": {
                                "@set": "hdWCxngbTW9udGhseVByb3BlcnR5T3RoZXJSZXZlbnVlgcqEdmJ5TW9udGhseVByb3BlcnR5RW50cnmBxmJ2MPT2gc1KBcZIXV4wFgAEMPbBghpnTL8KGgaOd4AQ"
                            },
                            "targetProperty": {
                                "@ref": {
                                    "id": "416099581287203328",
                                    "coll": {
                                        "@mod": "Property"
                                    }
                                }
                            },
                            "targetDate": {
                                "@date": "2024-12-01"
                            }
                        }
                    },
                    "roomTitle": "104",
                    "status": "HAS_RESIDENT",
                    "variableRentDeclarations": {
                        "data": []
                    },
                    "tenantOutflowAllocations": {
                        "data": []
                    }
                }
            ]
        }
    },
    "static_type": "{ _id: ID, rooms: { data: Array<Any>, after: String | Null } }",
    "summary": "",
    "txn_ts": 1733082890110000,
    "stats": {
        "compute_ops": 15,
        "read_ops": 38,
        "write_ops": 0,
        "query_time_ms": 57,
        "contention_retries": 0,
        "storage_bytes_read": 3904,
        "storage_bytes_write": 0,
        "rate_limits_hit": []
    },
    "schema_version": 1733082330770000
}

vs

// assigned to variable result

{
    "data": {
        "_id": "416099581427717632",
        "rooms": {
            "data": [
                {
                    "@doc": {
                        "id": "416099581625894400",
                        "coll": {
                            "@mod": "MonthlyPropertyRoom"
                        },
                        "ts": {
                            "@time": "2024-12-01T19:45:34.655Z"
                        },
                        "revenue": {
                            "@set": "hdWCxngiTW9udGhseVByb3BlcnR5Um9vbVJldmVudWVTdWJpdGVtc4HKhHVieU1vbnRobHlQcm9wZXJ0eVJvb22BxmJ2MPT2gc1KBcZIXWoABgAEQPbBghpnTL/pGh3cp0AQ"
                        },
                        "contracts": {
                            "@set": "hdWC1YLGeDRmaW5hbmNpYWxUcmFja2luZ1RlbmFudENvbnRyYWN0X21vbnRobHlQcm9wZXJ0eVJvb21zgcqEdWJ5TW9udGhseVByb3BlcnR5Um9vbYHGYnYw9PaByoRkJG1hcILMg4FtY29udHJhY3Rfcm9vbfbVgsZtY29udHJhY3Rfcm9vbYHJgnghZmluYW5jaWFsVHJhY2tpbmdUZW5hbnRDb250cmFjdElE9MZidjH09oLNSgXGSF1qAAYABED29sGCGmdMv+kaHdynQBA="
                        },
                        "monthlyPropertyEntry": {
                            "@ref": {
                                "id": "416099581427717632",
                                "coll": {
                                    "@mod": "MonthlyPropertyEntry"
                                }
                            }
                        },
                        "roomTitle": "402",
                        "status": "HAS_RESIDENT"
                    }
                },
                {
                    "@doc": {
                        "id": "416099581846096384",
                        "coll": {
                            "@mod": "MonthlyPropertyRoom"
                        },
                        "ts": {
                            "@time": "2024-12-01T19:45:34.655Z"
                        },
                        "revenue": {
                            "@set": "hdWCxngiTW9udGhseVByb3BlcnR5Um9vbVJldmVudWVTdWJpdGVtc4HKhHVieU1vbnRobHlQcm9wZXJ0eVJvb22BxmJ2MPT2gc1KBcZIXXcgCgAEQPbBghpnTL/pGh3cp0AQ"
                        },
                        "contracts": {
                            "@set": "hdWC1YLGeDRmaW5hbmNpYWxUcmFja2luZ1RlbmFudENvbnRyYWN0X21vbnRobHlQcm9wZXJ0eVJvb21zgcqEdWJ5TW9udGhseVByb3BlcnR5Um9vbYHGYnYw9PaByoRkJG1hcILMg4FtY29udHJhY3Rfcm9vbfbVgsZtY29udHJhY3Rfcm9vbYHJgnghZmluYW5jaWFsVHJhY2tpbmdUZW5hbnRDb250cmFjdElE9MZidjH09oLNSgXGSF13IAoABED29sGCGmdMv+kaHdynQBA="
                        },
                        "monthlyPropertyEntry": {
                            "@ref": {
                                "id": "416099581427717632",
                                "coll": {
                                    "@mod": "MonthlyPropertyEntry"
                                }
                            }
                        },
                        "roomTitle": "103",
                        "status": "HAS_RESIDENT"
                    }
                },
                {
                    "@doc": {
                        "id": "416099581991848448",
                        "coll": {
                            "@mod": "MonthlyPropertyRoom"
                        },
                        "ts": {
                            "@time": "2024-12-01T19:45:34.655Z"
                        },
                        "revenue": {
                            "@set": "hdWCxngiTW9udGhseVByb3BlcnR5Um9vbVJldmVudWVTdWJpdGVtc4HKhHVieU1vbnRobHlQcm9wZXJ0eVJvb22BxmJ2MPT2gc1KBcZIXX/QCgAEQPbBghpnTL/pGh3cp0AQ"
                        },
                        "contracts": {
                            "@set": "hdWC1YLGeDRmaW5hbmNpYWxUcmFja2luZ1RlbmFudENvbnRyYWN0X21vbnRobHlQcm9wZXJ0eVJvb21zgcqEdWJ5TW9udGhseVByb3BlcnR5Um9vbYHGYnYw9PaByoRkJG1hcILMg4FtY29udHJhY3Rfcm9vbfbVgsZtY29udHJhY3Rfcm9vbYHJgnghZmluYW5jaWFsVHJhY2tpbmdUZW5hbnRDb250cmFjdElE9MZidjH09oLNSgXGSF1/0AoABED29sGCGmdMv+kaHdynQBA="
                        },
                        "monthlyPropertyEntry": {
                            "@ref": {
                                "id": "416099581427717632",
                                "coll": {
                                    "@mod": "MonthlyPropertyEntry"
                                }
                            }
                        },
                        "roomTitle": "401",
                        "status": "HAS_RESIDENT"
                    }
                },
                {
                    "@doc": {
                        "id": "416099582107191808",
                        "coll": {
                            "@mod": "MonthlyPropertyRoom"
                        },
                        "ts": {
                            "@time": "2024-12-01T19:45:34.655Z"
                        },
                        "revenue": {
                            "@set": "hdWCxngiTW9udGhseVByb3BlcnR5Um9vbVJldmVudWVTdWJpdGVtc4HKhHVieU1vbnRobHlQcm9wZXJ0eVJvb22BxmJ2MPT2gc1KBcZIXYawCgAEQPbBghpnTL/pGh3cp0AQ"
                        },
                        "contracts": {
                            "@set": "hdWC1YLGeDRmaW5hbmNpYWxUcmFja2luZ1RlbmFudENvbnRyYWN0X21vbnRobHlQcm9wZXJ0eVJvb21zgcqEdWJ5TW9udGhseVByb3BlcnR5Um9vbYHGYnYw9PaByoRkJG1hcILMg4FtY29udHJhY3Rfcm9vbfbVgsZtY29udHJhY3Rfcm9vbYHJgnghZmluYW5jaWFsVHJhY2tpbmdUZW5hbnRDb250cmFjdElE9MZidjH09oLNSgXGSF2GsAoABED29sGCGmdMv+kaHdynQBA="
                        },
                        "monthlyPropertyEntry": {
                            "@ref": {
                                "id": "416099581427717632",
                                "coll": {
                                    "@mod": "MonthlyPropertyEntry"
                                }
                            }
                        },
                        "roomTitle": "300",
                        "status": "HAS_RESIDENT"
                    }
                },
                {
                    "@doc": {
                        "id": "416099582200516096",
                        "coll": {
                            "@mod": "MonthlyPropertyRoom"
                        },
                        "ts": {
                            "@time": "2024-12-01T19:45:34.655Z"
                        },
                        "revenue": {
                            "@set": "hdWCxngiTW9udGhseVByb3BlcnR5Um9vbVJldmVudWVTdWJpdGVtc4HKhHVieU1vbnRobHlQcm9wZXJ0eVJvb22BxmJ2MPT2gc1KBcZIXYxADgAEQPbBghpnTL/pGh3cp0AQ"
                        },
                        "contracts": {
                            "@set": "hdWC1YLGeDRmaW5hbmNpYWxUcmFja2luZ1RlbmFudENvbnRyYWN0X21vbnRobHlQcm9wZXJ0eVJvb21zgcqEdWJ5TW9udGhseVByb3BlcnR5Um9vbYHGYnYw9PaByoRkJG1hcILMg4FtY29udHJhY3Rfcm9vbfbVgsZtY29udHJhY3Rfcm9vbYHJgnghZmluYW5jaWFsVHJhY2tpbmdUZW5hbnRDb250cmFjdElE9MZidjH09oLNSgXGSF2MQA4ABED29sGCGmdMv+kaHdynQBA="
                        },
                        "monthlyPropertyEntry": {
                            "@ref": {
                                "id": "416099581427717632",
                                "coll": {
                                    "@mod": "MonthlyPropertyEntry"
                                }
                            }
                        },
                        "roomTitle": "104",
                        "status": "HAS_RESIDENT"
                    }
                }
            ]
        }
    },
    "static_type": "{ _id: ID, rooms: { data: Array<MonthlyPropertyRoom>, after: String | Null } }",
    "summary": "",
    "txn_ts": 1733083113501000,
    "stats": {
        "compute_ops": 4,
        "read_ops": 9,
        "write_ops": 0,
        "query_time_ms": 37,
        "contention_retries": 0,
        "storage_bytes_read": 1687,
        "storage_bytes_write": 0,
        "rate_limits_hit": []
    },
    "schema_version": 1733082330770000
}

Here is the getRoomFieldsForRoom function for reference:

function getRoomFieldsForRoom(room: MonthlyPropertyRoom): Any {
  let contracts = financialTrackingTenantContract_monthlyPropertyRooms.byMonthlyPropertyRoom(room)
    .map(contract_room => contract_room.financialTrackingTenantContractID){
      _id: .id,
      contractStartDate,
      contractEndDate,
      tenant {
        _id: .id,
        tenantName
      },
      hasVariableRent
    }
  
  let variableRentDeclarations = FinancialTrackingTenantMonthlyEntryVariableRent.byMonthlyPropertyRoom(room) {
    _id: .id,
    userDefinedVariableAmount,
    contract {
      _id: .id
    }
  }

  let revenue = MonthlyPropertyRoomRevenueSubitems.byMonthlyPropertyRoom(room){
    _id: .id,
    rentPayment,
    delinquencyAmount,
    note
  }

  let tenantOutflowAllocations = FinancialTrackingTenantMonthlyEntryOutflowAllocation.byMonthlyPropertyRoom(room) {
    _id: .id,
    rentAmount,
    delinquentRent,
    hasFullCoverage,
    contract {
      _id: .id
    }
  }

  room {
    _id: .id,
    roomTitle,
    status,
    vacancy,
    contracts: contracts.paginate(100),
    variableRentDeclarations: variableRentDeclarations.paginate(100),
    revenue: revenue.paginate(1000),
    tenantOutflowAllocations: tenantOutflowAllocations.paginate(100)
  }
}

These were tested on the latest fauna/faunadb:5.30.0 docker image locally

Hi @wallslide!

I think the issue may be that in the second query you run roomsSet.map(room => getRoomFieldsForRoom(room)) but do not set it to a variable, so it is executed but not passed on to anything. Different outputs are expected. Can you confirm that what you shared is exactly what you are sending?

Here is what you would need to do to reassign the variable.

let monthlyPropertyEntry = MonthlyPropertyEntry.byPropertyAndDate(Property(${propertyId}), Date.fromString(${date})).first()!
let roomsSet = MonthlyPropertyRoom.byMonthlyPropertyEntry(monthlyPropertyEntry)

// reassign to roomsSet
let roomsSet = roomsSet.map(room => getRoomFieldsForRoom(room))

monthlyPropertyEntry {
  _id: .id,
  rooms: roomsSet.paginate(1000)
}

Thank you for solving the mystery! Somehow that missing variable assignment eluded me for hours and I ended up getting rid of it and using the direct map chain call instead.

oh no! Well, I am glad it’s sorted now :smile: Cheers!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.