Comment to explain the behaviour of the junction document select.

This commit is contained in:
mike12345567 2024-12-19 12:39:00 +00:00
parent 92e791f9a7
commit 889197679e
1 changed files with 6 additions and 0 deletions

View File

@ -121,6 +121,12 @@ async function buildInternalFieldList(
if (!relatedTable) {
continue
}
// a quirk of how junction documents work in Budibase, refer to the "LinkDocument" type to see the full
// structure - essentially all relationships between two tables will be inserted into a single "table"
// we don't use an independent junction table ID for each separate relationship between two tables. For
// example if we have table A and B, with two relationships between them, all the junction documents will
// end up in the same junction table ID. We need to retrieve the field name property of the junction documents
// as part of the relationship to tell us which relationship column the junction is related to.
const relatedFields = (
await buildInternalFieldList(relatedTable, tables)
).concat(