I have an object db that has one field containing SKU's that correspond to another object that contains different venues.
db.SKU = [1002,1005,1001,1008,1007];
I then have another object listing the different venues and their details;
db.venueDB = [
{
SKU : 1001,
active : 1,
round : 1,
date : "02/03/2026",
country : "Germany"
},
{
SKU : 1002,
active : 1,
round : 2,
date : "23/04/2026",
country : "Czechia"
},{
SKU : 1003,
round : 3,
active : 1,
date : "05/05/2026",
country : "United Kingdom"
},{
SKU : 1004,
round : 5,
active : 1,
country : "Spain",
date : "20/07/2026"
},{
SKU : 1005,
round : 6,
active : 1,
country : "Sweden",
date : "21/07/2026"
},{
SKU : 1006,
active : 1,
round : 7,
country : "Brazil",
date : "01/98/2026"
},{
SKU : 1007,
active : 1,
round : 8,
country : "Latvia",
date : "08/09/2026"
},{
SKU : 1008,
round : 9,
active : 1,
country : "Denmark",
date : "12/10/2026"
}
]
Using the db.SKU I want to query db.venueDB to see if the SKU matches, and push that too a new filtered array containing the new details - in this case the new filtered array would be the venues with the SKU's, 1002, 1005, 1001, 1008 & 1007.
I know with this amount of data I could use a simple for/next loop but I have scaled down the data for this example.
I am not sure what is best or quickest way to do this, either using reduce or filter but unsure how to put this into practice.