I'm trying to simulate a join in a mongo query so I'm taking the results of my 1st query and then passing it as a $in filter to my 2nd query.
Unfortunately the results of my 1st query returns an array of json objects like so
[ { _id: 4ecd830da046050100000025 },
{ _id: 4ecd84a0a046050100000085 } ]
and the $in filter doesn't return anything because they are json objects instead of a value array. I can manually transform that array but is there a built in method or function that I can use? Also, is there a way I can have mongo return the value array instead? Currently I am calling the find query as such
Likes.find {liker:"Me"}, {_id:1}, {safe:true}
And here is my 2nd query
Post.find {_id:{$in:likes}}
I was hoping for something like
Post.find {_id:{$in:likes._id}}