I might have a mistake as I failed to find my reference line about this: if you use “exec”, previous stages were first combined and then executed. I had the idea that documents are first populated and find operation was applied. I could even misunderstand that line. I will check this later on.
anyways, for now, let’s try to check your use of the code. unlike for color and size, you don’t seem to convert any id field for department and category. so, how do you use your buildProductQuery function and what are the values of these variables: { department, category, color, size } = query (edit sensitive information)