%dw 2.0
output application/json
var testObject = {
	collectionToCheck: [
		{
			id: "id_1",
			collection: [{
				id: "firstKeyToMiss",
				valueToCheck: [1,2,3,4]
			}]
		},
		{
			id: "id_2",
			collection: [{
				id: "onlyKeyToFind",
				valueToCheck: [5,6,7,8]
			}]
		},
		{
			id: "id_3",
			collection: [{
				id: "secondKeyToMiss",
				valueToCheck: [9,10,11,12]
			}]
		}
	]
}
---
testObject.collectionToCheck map ((category) -> {
	id: category.id,
	elements: category.collection filter ($.id == "onlyKeyToFind")
}) filter (sizeOf($.elements) != 0)