How to fetch all the values of the specified date in the particular array

{
	"_id" : ObjectId("627e2e35ae6cd2104c58ef38"),
	"attendance" : [ ],
	"groupId" : ObjectId("5f06cca74e51ba15f5167b86"),
	"isActive" : true,
	"month" : 5,
	"teamId" : ObjectId("6069a681a0ccf704e78a720c"),
	"userId" : ObjectId("6070b1d5b6d3d082e72c0cd8"),
	"year" : 2022,
	"offlineAttendance" : [
		{
			"attendance" : true,
			"attendanceAt" : "2022-05-13T10:08:53.322930Z",
			"attendanceId" : "627e2e35ae6cd2104c58ef63",
			"date" : "13-05-2022",
			"dateString" : "20220513",
			"day" : 13,
			"isApproved" : false,
			"subjectId" : "606b6fa1a0ccf7222260a570",
			"subjectName" : "English",
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "15:38"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-13T11:30:18.734192Z",
			"attendanceId" : "627e414aae6cd2104c8cd4d9",
			"date" : "13-05-2022",
			"dateString" : "20220513",
			"day" : 13,
			"isApproved" : false,
			"subjectId" : "606b6fa1a0ccf7222260a570",
			"subjectName" : "English",
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "17:00"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-14T04:36:47.146191Z",
			"attendanceId" : "627f31dfae6cd20cef0878bb",
			"date" : "14-05-2022",
			"dateString" : "20220514",
			"day" : 14,
			"isApproved" : true,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:06"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-15T09:41:34.588895Z",
			"attendanceId" : "6280caceae6cd208d95bda7a",
			"date" : "15-05-2022",
			"dateString" : "20220515",
			"day" : 15,
			"isApproved" : true,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "15:11"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-18T04:58:28.541419Z",
			"attendanceId" : "62847cf4ae6cd20eb1e1ebb0",
			"date" : "18-05-2022",
			"dateString" : "20220518",
			"day" : 18,
			"isApproved" : false,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:28"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-18T05:02:01.584568Z",
			"attendanceId" : "62847dc9ae6cd20eb1a772be",
			"date" : "18-05-2022",
			"dateString" : "20220518",
			"day" : 18,
			"isApproved" : false,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:32"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-18T05:11:53.673496Z",
			"attendanceId" : "62848019ae6cd20eb1e54319",
			"date" : "18-05-2022",
			"dateString" : "20220518",
			"day" : 18,
			"isApproved" : false,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:41"
		}
	]
}
{
	"_id" : ObjectId("627e2e35ae6cd2104c58ef39"),
	"attendance" : [ ],
	"groupId" : ObjectId("5f06cca74e51ba15f5167b86"),
	"isActive" : true,
	"month" : 5,
	"teamId" : ObjectId("6069a681a0ccf704e78a720c"),
	"userId" : ObjectId("6070b1d5b6d3d082e72c0cdb"),
	"year" : 2022,
	"offlineAttendance" : [
		{
			"attendance" : true,
			"attendanceAt" : "2022-05-13T10:08:53.322930Z",
			"attendanceId" : "627e2e35ae6cd2104c58ef63",
			"date" : "13-05-2022",
			"dateString" : "20220513",
			"day" : 13,
			"isApproved" : false,
			"subjectId" : "606b6fa1a0ccf7222260a570",
			"subjectName" : "English",
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "15:38"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-13T11:30:18.734192Z",
			"attendanceId" : "627e414aae6cd2104c8cd4d9",
			"date" : "13-05-2022",
			"dateString" : "20220513",
			"day" : 13,
			"isApproved" : false,
			"subjectId" : "606b6fa1a0ccf7222260a570",
			"subjectName" : "English",
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "17:00"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-14T04:36:47.146191Z",
			"attendanceId" : "627f31dfae6cd20cef0878bb",
			"date" : "14-05-2022",
			"dateString" : "20220514",
			"day" : 14,
			"isApproved" : true,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:06"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-15T09:41:34.588895Z",
			"attendanceId" : "6280caceae6cd208d95bda7a",
			"date" : "15-05-2022",
			"dateString" : "20220515",
			"day" : 15,
			"isApproved" : true,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "15:11"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-18T04:58:28.541419Z",
			"attendanceId" : "62847cf4ae6cd20eb1e1ebb0",
			"date" : "18-05-2022",
			"dateString" : "20220518",
			"day" : 18,
			"isApproved" : false,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:28"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-18T05:02:01.584568Z",
			"attendanceId" : "62847dc9ae6cd20eb1a772be",
			"date" : "18-05-2022",
			"dateString" : "20220518",
			"day" : 18,
			"isApproved" : false,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:32"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-18T05:11:53.673496Z",
			"attendanceId" : "62848019ae6cd20eb1e54319",
			"date" : "18-05-2022",
			"dateString" : "20220518",
			"day" : 18,
			"isApproved" : false,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:41"
		}
	]
}
{
	"_id" : ObjectId("627e2e35ae6cd2104c58ef3a"),
	"attendance" : [ ],
	"groupId" : ObjectId("5f06cca74e51ba15f5167b86"),
	"isActive" : true,
	"month" : 5,
	"teamId" : ObjectId("6069a681a0ccf704e78a720c"),
	"userId" : ObjectId("6070b1d5b6d3d082e72c0cde"),
	"year" : 2022,
	"offlineAttendance" : [
		{
			"attendance" : true,
			"attendanceAt" : "2022-05-13T10:08:53.322930Z",
			"attendanceId" : "627e2e35ae6cd2104c58ef63",
			"date" : "13-05-2022",
			"dateString" : "20220513",
			"day" : 13,
			"isApproved" : false,
			"subjectId" : "606b6fa1a0ccf7222260a570",
			"subjectName" : "English",
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "15:38"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-13T11:30:18.734192Z",
			"attendanceId" : "627e414aae6cd2104c8cd4d9",
			"date" : "13-05-2022",
			"dateString" : "20220513",
			"day" : 13,
			"isApproved" : false,
			"subjectId" : "606b6fa1a0ccf7222260a570",
			"subjectName" : "English",
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "17:00"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-14T04:36:47.146191Z",
			"attendanceId" : "627f31dfae6cd20cef0878bb",
			"date" : "14-05-2022",
			"dateString" : "20220514",
			"day" : 14,
			"isApproved" : true,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:06"
		},
		{
			"attendance" : "absent",
			"attendanceAt" : "2022-05-15T09:41:34.588895Z",
			"attendanceId" : "6280caceae6cd208d95bda7a",
			"date" : "15-05-2022",
			"dateString" : "20220515",
			"day" : 15,
			"isApproved" : true,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "15:11"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-18T04:58:28.541419Z",
			"attendanceId" : "62847cf4ae6cd20eb1e1ebb0",
			"date" : "18-05-2022",
			"dateString" : "20220518",
			"day" : 18,
			"isApproved" : false,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:28"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-18T05:02:01.584568Z",
			"attendanceId" : "62847dc9ae6cd20eb1a772be",
			"date" : "18-05-2022",
			"dateString" : "20220518",
			"day" : 18,
			"isApproved" : false,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:32"
		},
		{
			"attendance" : "present",
			"attendanceAt" : "2022-05-18T05:11:53.673496Z",
			"attendanceId" : "62848019ae6cd20eb1e54319",
			"date" : "18-05-2022",
			"dateString" : "20220518",
			"day" : 18,
			"isApproved" : false,
			"teacherId" : "6069a5daa0ccf704e7319d16",
			"teacherName" : "Admin ",
			"time" : "10:41"
		}
	]
}

MONGO QUERY
db.offline_class_attendance.find({“month”:5,“offlineAttendance.day”:18},{“offlineAttendance.day.$”:1}).pretty()

{
	"_id" : ObjectId("627e2e35ae6cd2104c58ef27"),
	"offlineAttendance" : [
		{
			"day" : 18
		}
	]
}
{
	"_id" : ObjectId("627e2e35ae6cd2104c58ef28"),
	"offlineAttendance" : [
		{
			"day" : 18
		}
	]
}
{
	"_id" : ObjectId("627e2e35ae6cd2104c58ef29"),
	"offlineAttendance" : [
		{
			"day" : 18
		}
	]
}

when i project i’m getting the first day:“18” in that array but want to grab all day:“18”

db.offline_class_attendance.find({“month”:5,“offlineAttendance.day”:18},{“offlineAttendance.day.$”:1}).pretty()

Try to do that in an aggregation $set stage using $filter.