My json data will look like this
{
"data": [
{
"_id": "621e139dd65883978081b6a4",
"videoId": 29,
"__v": 0,
"createdAt": "2022-03-01T12:37:49.734Z",
"updatedAt": "2022-03-04T08:47:21.481Z",
"videoComments": [
{
"comment": "happy",
"userId": 15,
"commentTime": "2022-03-01T12:37:49.734Z",
"userName": "user1646127068323",
"deletedbyowner": "FALSE",
"uid": "7TRmiNZ90nfyXupJIzlnBkKFnm03",
"_id": "621e139d8e4195079c864818",
"replyComments": [
{
"replyComment": "reply check",
"replyCommentTime": "2022-03-01T12:44:53.193Z",
"replyDeletedbyowner": "FALSE",
"_id": "621e154557fa7045e3425410"
}
]
},
{
"comment": "happy",
"userId": 15,
"commentTime": "2022-03-01T12:38:35.116Z",
"userName": "user1646127068323",
"deletedbyowner": "FALSE",
"uid": "7TRmiNZ90nfyXupJIzlnBkKFnm03",
"_id": "621e13cb7d2f6265aa7ff7ac",
"replyComments": []
},
{
"comment": "happy",
"userId": 38,
"commentTime": "2022-03-01T12:39:26.064Z",
"userName": "user1646127068323",
"deletedbyowner": "FALSE",
"uid": "7TRmiNZ90nfyXupJIzlnBkKFnm03",
"_id": "621e13fe7d2f6265aa7ff7be",
"replyComments": [
{
"replyComment": "reply check2",
"replyCommentTime": "2022-03-04T08:47:21.479Z",
"replyDeletedbyowner": "FALSE",
"_id": "6221d21945208781d16377f9"
}
]
}
]
}
]
}
I need to match some conditions that I mentioned below :
match "videoId" == "29"
then match "videoComments.deletedbyowner" == "FALSE"
if I match second condition then I need to match "videoComments.replyComments.replyDeletedbyowner" == "FALSE"
I need to sort the result for the user who is viewing the comment, in my case it is userId:38
So I need to show this particular comment at first.(my comment should be at first when I am viewing the comment list). I can't use unwind because my boss told me that unwind is a costly operation it will effect the app performance. so without using unwind I need to match these conditions. could you please help me out of this.