I need help in connect four Collection

@contact39131
Complete this code here…

function  start_Function() {
    wixData.query("All Product Details").include("CategoryS").find()
    .then( (results) => {
        if(results.items.length > 0) {
        let RESULT = results.items;
        let firstITEM = RESULT[0];
        console.log(RESULT)
        console.log(firstITEM)
        let output1 = [], output2 = []
 
        for (var i = 1; i < results.items.length; i++) {
            output1.push(categoryS[i].???????????????????)
            output2.push(categoryS[i].???????????????????)
        }
        console.log(output1, output2)
        $w('#TXToutput1').text=output1.toString()
        $w('#TXToutput2').text=output2.toString()
    } else {    }
  } )
}

You have to look at the following lines… (example for SIZE).

 wixData.query("Main-Data-Collection").include("REFERENCED-FIELD")

Look what is the ID of your MAIN-Data-Collection
Look what is the ID of your included reference-field.

wixData.query("Main-Data-Collection")
    .include("REFERENCED-FIELD1") ---->  for example color
    .include("REFERENCED-FIELD2") ---->  for example size

Also change the output-settings…

output1.push(RESULT[i].???????????????????)
output2.push(RESULT[i].???????????????????)
output1.push(RESULT[i].REFERENCE-FIELD1-ID.REFERENCED-FIELD in your second DB)
output1.push(RESULT[i].sizeA.size) 

Take also a look into your console. You will find all the needed results and structure to look at and understand.