hi samuel,
tnx its works…
I have another question if possible?
I have 2 collections.
One named “test” and the other named “return”
I am attaching an example for your information:
“test”****
{
"_id": {
"$oid": "656d92878d00894df4a17a9b"
},
"rmt_srv_pn": "1738_RMT_SECTOR_M_V02",
"fail": [
"10705689",
"10705668",
"10705573",
"10705065",
"10701339",
"10706051",
"10701247",
"10706023",
"10705465"
],
"pass": [
"10706217",
"10700962",
"10704946",
"10705440",
"10706181",
"10706030",
"10706022",
"10706245",
"10705666",
"10705664",
"10701313",
"10706037",
"10705657",
"10706015",
"10701335",
"10705436",
"10701328",
"10705893",
"10705900",
"10705904",
"10705449",
"10705630",
"10705629",
"10705453",
"10706043",
"10705462",
"10701344"
],
"total": 36,
"stage_id": "Verification_level",
"serials_return_period": [],
"serial_combined": [
"10700962",
"10701247",
"10701313",
"10701328",
"10701335",
"10701339",
"10701344",
"10704946",
"10705065",
"10705436",
"10705440",
"10705449",
"10705453",
"10705462",
"10705465",
"10705573",
"10705629",
"10705630",
"10705657",
"10705664",
"10705666",
"10705668",
"10705689",
"10705893",
"10705900",
"10705904",
"10706015",
"10706022",
"10706023",
"10706030",
"10706037",
"10706043",
"10706051",
"10706181",
"10706217",
"10706245"
]
}
“return”***
{
"_id": {
"$oid": "656d82f38d00894df494a1f1"
},
"serial": "11115711",
"cavity_data": [
{
"_id": {
"$oid": "653674d81e3a310cc0f4b4d3"
},
"rmt_srv": {
"ip": "192.168.12.105",
"host": "",
"pn": "1985_CP_MINI_GW_V12_A_B01",
"os": "",
"location": "afula"
},
"develop": false,
"time": {
"$date": "2023-10-23T16:27:52.719Z"
},
"pn_cfg": "7620940",
"cavity": "1",
"type": "finish",
"_exec_st": {
"$oid": "653673e71e3a310cc0f4b3e1"
},
"_log": "509d4bfa-72eb-4479-bac1-679cb926c393",
"cavity_st": {
"$date": "2023-10-23T16:23:51.496Z"
},
"batch": "094189793",
"pass": true,
"_cav_st": {
"$oid": "653673e71e3a310cc0f4b3e2"
},
"user": "tst",
"faulty_test_name": null,
"_cfg": "64ec2f7dc65e12000153652b",
"duration": 241223,
"pn_cfg_rev": "4900",
"serial": "11115711",
"dut": {
"pn": "0694940",
"model": "PROG ORG-CONTROL PANEL V12",
"rev": "2C1",
"desc": "PROG ORG-CONTROL PANEL V12"
},
"production_step": "094189793"
},
{
"_id": {
"$oid": "65380d961e3a3113a0d4d66d"
},
"rmt_srv": {
"ip": "192.168.12.108",
"host": "",
"pn": "1185_CP_MINI_GW_IMP_V03(1)",
"os": "",
"location": "afula"
},
"develop": false,
"time": {
"$date": "2023-10-24T21:31:50.653Z"
},
"pn_cfg": "8609940",
"cavity": "1",
"type": "finish",
"_exec_st": {
"$oid": "65380d481e3a3113a0d4d622"
},
"_log": "575e1129-e396-4770-9dd2-3e93630f3047",
"cavity_st": {
"$date": "2023-10-24T21:30:32.146Z"
},
"batch": "094189350",
"pass": true,
"_cav_st": {
"$oid": "65380d481e3a3113a0d4d623"
},
"user": "tst",
"faulty_test_name": null,
"_cfg": "6534d0e17911e800010ab2cd",
"duration": 78507,
"pn_cfg_rev": "4900",
"serial": "11115711",
"dut": {
"pn": "220094940",
"model": "ORG-220094940",
"rev": "2C1-06",
"desc": "ORG-CONTROL PANEL 4G V3"
},
"production_step": "094189350"
},
{
"_id": {
"$oid": "6553e7821e3a3110d88d1f8b"
},
"rmt_srv": {
"ip": "192.168.12.228",
"host": "",
"pn": "1985_CP_MINI_GW_V12_A_B02",
"os": "",
"location": "afula"
},
"develop": false,
"time": {
"$date": "2023-11-14T23:32:50.189Z"
},
"pn_cfg": "7694940",
"cavity": "1",
"type": "finish",
"_exec_st": {
"$oid": "6553e6581e3a3110d88d1e9c"
},
"_log": "c4ba50a8-fb09-45b4-b422-4e5c0c5c9e81",
"cavity_st": {
"$date": "2023-11-14T23:27:52.164Z"
},
"batch": "104229463",
"pass": true,
"_cav_st": {
"$oid": "6553e6581e3a3110d88d1e9d"
},
"user": "tst",
"faulty_test_name": null,
"_cfg": "6550cd7cacc7ca0001dd424c",
"duration": 298025,
"pn_cfg_rev": "4980",
"serial": "11115711",
"dut": {
"pn": "0694940",
"model": "PROG ORG-CONTROL PANEL V12",
"rev": "2C1",
"desc": "PROG ORG-CONTROL PANEL V12"
},
"production_step": "104229463"
}
],
"Board_level": 2,
"Verification_level": 1,
"rmt_srv_pn": [
"1985_CP_MINI_GW_V12_A_B02",
"1185_CP_MINI_GW_IMP_V03(1)",
"1985_CP_MINI_GW_V12_A_B01"
]
}
type or paste code here
I want to write an aggregation that will perform a test:
In the documents of the “return” collection there are serials on which tests were performed in the past and they were recorded in the document, I need to locate the same serial in the documents of the “test” collection under the same condition of border and verification and it is enough that there is one or more in the “return” documents, then it is necessary Subtract the numbers from fail or pass and also subtract from the total.