Database

[{"_id":{"$oid":"6267a966fe9fa7f41d42d255"},"new_yn":"Y","port_info":[{"ip_port":"199.20.93.164:80","use_yn":"Y","comment":"","port_code":"http_https","uri_info":[{"uri":"199.20.93.164/","status_code":404}]},{"ip_port":"199.20.93.164:5985","use_yn":"Y","comment":"","port_code":"http_https","uri_info":[{"uri":"199.20.93.164:5985","status_code":200}]},{"ip_port":"199.20.93.164:21 ","use_yn":"Y","comment":"","port_code":"ftp"}]},{"_id":{"$oid":"6267a966fe9fa7f41d42d299"},"new_yn":"Y","port_info":[{"ip_port":"199.20.93.164:21 ","use_yn":"Y","comment":"","port_code":"ftp"}]}]

Query

db.collection.aggregate([{$match:{"new_yn":"Y","port_info":{$elemMatch:{"port_code":"http_https"}}}},{$project:{port_info:{$filter:{input:"$port_info",as:"item",cond:{$eq:["$$item.port_code","http_https"]}}}}},{"$project":{"_id":1,"new_yn":1,"port_info.ip_port":1}}])

Result