A solution to this problem can be solved with aggregate of mongodb and we help each other $filtet to make the solution more efficient.db.Prueba.aggregate([
{ $match: { "_id": ObjectId("5fd5e617260828c7646000aa") } },
{ $project: {
"q2.Results": { $filter: {
input: "$q2.Results",
as: "resultado",
cond: { $eq: [ "$$resultado.UserNickname", "Jackobear" ] }
}
}
}
}
])
Then the result shows the complete document but with the sub documents of the matrix (Array) q2.Results whose value UserNickname equals "Jackobear"{
"_id" : ObjectId("5fd5e617260828c7646000aa"),
"q2" : {
"Results" : [
{
"Id" : "163069310",
"CID" : "eb523c23-980d-5661-b9d0-c6dc1028fa42",
"SourceClient" : "sephora-fr",
"Badges" : {
"loyaltyYes--Im-a-VIB-Rouge" : {
"ContentType" : "REVIEW",
"Id" : "loyaltyYes--Im-a-VIB-Rouge",
"BadgeType" : "Custom"
}
},
"BadgesOrder" : [
"loyaltyYes--Im-a-VIB-Rouge"
],
"LastModeratedTime" : "2020-09-22T12:00:18.000+00:00",
"LastModificationTime" : "2020-12-10T14:36:16.000+00:00",
"ProductId" : "P3742199",
"CampaignId" : "BV_PIE_ONLINE",
"ContextDataValuesOrder" : [
"Gender",
"Eyes",
"Skin"
],
"UserLocation" : "Paris",
"AuthorId" : "78948942",
"ContentLocale" : "fr_FR",
"IsFeatured" : false,
"TotalInappropriateFeedbackCount" : {
"$numberInt" : "0"
},
"TotalClientResponseCount" : {
"$numberInt" : "0"
},
"TotalCommentCount" : {
"$numberInt" : "0"
},
"Rating" : {
"$numberInt" : "5"
},
"IsRatingsOnly" : false,
"IsRecommended" : true,
"Helpfulness" : {
"$numberDouble" : "1.0"
},
"TotalFeedbackCount" : {
"$numberInt" : "2"
},
"TotalNegativeFeedbackCount" : {
"$numberInt" : "0"
},
"TotalPositiveFeedbackCount" : {
"$numberInt" : "2"
},
"ModerationStatus" : "APPROVED",
"SubmissionId" : "r23232-fr__16007743UA3Zr3O9L5",
"SubmissionTime" : "2020-09-22T11:32:57.000+00:00",
"ReviewText" : "J’adore, il sent le bord de mer une ressemblance avec le parfum Kenzo",
"Title" : "Très bon parfum",
"UserNickname" : "Jackobear",
"ContextDataValues" : {
"Gender" : {
"Value" : "Male",
"Id" : "Gender"
},
"Skin" : {
"Value" : "Normale",
"Id" : "Skin"
},
"Eyes" : {
"Value" : "Marrons",
"Id" : "Eyes"
}
},
"Videos" : [],
"Pros" : null,
"InappropriateFeedbackList" : [],
"SecondaryRatings" : {},
"ClientResponses" : [],
"Photos" : [],
"Cons" : null,
"IsSyndicated" : false,
"SecondaryRatingsOrder" : [],
"AdditionalFields" : {},
"RatingRange" : {
"$numberInt" : "5"
},
"TagDimensions" : {},
"AdditionalFieldsOrder" : [],
"ProductRecommendationIds" : [],
"CommentIds" : [],
"TagDimensionsOrder" : []
}
]
}
}