"$in needs an array" but the argument is clearly an array

I’m doing a lookup from another collection to bring over an array of _ids, from which I’ll then $match a given property of my document. If I just $project:1 it, I’m seeing an array, clear as day. But when I try to use it as a filter with match, for MongoDB it is not an array. What gives?

Hello @Gonzalo_Munoz ,

Welcome to The MongoDB Community Forums! :wave:

To understand your use case better, could you please share below details:

  • MongoDB version
  • Some sample documents
  • The query you are trying to use
  • Expected output
  • The error you are facing


I’m sorry, thanks for your reply but I had to move on and I ended up filtering the data server side.