Inserting fetch response into a collection

Ah it seems I misunderstood the first time. This should do it for you:

//Get The results array
const resultArray = [...data[0]['property/sales_history'].result];

//For each item in the results array, insert it into the toInsert Object
//The toInsert object will be inserted only once
resultArray.forEach((item) => {
    toInsert[item] = item;
});

Add this before you insert the toInsert object into your collection.

Hope this helps,
Majd