As for aggregating records in a project to find _id in the array and to only him?

Is it possible to find the aggregation _id and leave in the mountains only to withdraw it or to true (the fact that it is present in the array)?

Here is the document itself
likes: [ObjectId('id_user_1'), ObjectId('id_user_2'), ObjectId('id_user_3')]

In the sample, I know the _id of the user (sessionId)
.aggregate([
 $project: {
 _id: 1,
 likes: {
 // display if the found _id - true or false , or leave only the found id in the array or an empty array
}
}
])

Could you pull that off?

Tried did not help
likes: { $filter: {
 input: "$likes",
 as: "likes",
 cond: { "_id": request.sessionId }
}}
June 10th 19 at 14:31
0 answer

Find more questions by tags MongoDBMongooseNode.js