How could i update my collection based on the value of an element

hello everybody i have the following collection

{
	"_id": {
		"$oid": "619e5b74cbcebb0ef472c7b8"
	},
	"24-11-2021": [{
		"job_id": 467,
		"overlap": {
			"430": 10,
			"437": 60,
			"441": 6,
			"445": 25,
			"464": 3,
			"467": 9,
			"498": 9
		},
		"non_exclusive": 0,
		"exclusive": 0,
		"No_of_object": 0,
		"activity": {},
		"job_context": {},
		"vendor_product_version": {}
	}, {
		"job_id": 498,
		"overlap": {
			"430": 10,
			"437": 60,
			"441": 6,
			"445": 25,
			"464": 3,
			"467": 9,
			"498": 9
		},
		"non_exclusive": 0,
		"exclusive": 0,
		"No_of_object": 0,
		"activity": {},
		"job_context": {},
		"vendor_product_version": {}
	}, {
		"job_id": 430,
		"overlap": {
			"430": 16,
			"437": 290,
			"441": 30,
			"445": 128,
			"464": 6,
			"467": 10,
			"498": 10
		},
		"non_exclusive": 0,
		"exclusive": 0,
		"No_of_object": 0,
		"activity": {},
		"job_context": {},
		"vendor_product_version": {}
	}, {
		"job_id": 437,
		"overlap": {
			"430": 290,
			"437": 13156,
			"441": 1374,
			"445": 5902,
			"464": 156,
			"467": 60,
			"498": 60
		},
		"non_exclusive": 0,
		"exclusive": 0,
		"No_of_object": 0,
		"activity": {},
		"job_context": {},
		"vendor_product_version": {}
	}, {
		"job_id": 441,
		"overlap": {
			"430": 30,
			"437": 1374,
			"441": 144,
			"445": 618,
			"464": 18,
			"467": 6,
			"498": 6
		},
		"non_exclusive": 0,
		"exclusive": 0,
		"No_of_object": 0,
		"activity": {},
		"job_context": {},
		"vendor_product_version": {}
	}, {
		"job_id": 445,
		"overlap": {
			"430": 128,
			"437": 5902,
			"441": 618,
			"445": 2653,
			"464": 75,
			"467": 25,
			"498": 25
		},
		"non_exclusive": 0,
		"exclusive": 0,
		"No_of_object": 0,
		"activity": {},
		"job_context": {},
		"vendor_product_version": {}
	}, {
		"job_id": 464,
		"overlap": {
			"430": 6,
			"437": 156,
			"441": 18,
			"445": 75,
			"464": 9,
			"467": 3,
			"498": 3
		},
		"non_exclusive": 0,
		"exclusive": 0,
		"No_of_object": 0,
		"activity": {},
		"job_context": {},
		"vendor_product_version": {}
	}, {
		"job_id": 9000,
		"overlap": {
			"9000": 1
		},
		"non_exclusive": 0,
		"exclusive": 0,
		"No_of_object": 0,
		"activity": {},
		"job_context": {},
		"vendor_product_version": {}
	}]
}

i want to update the document (only this one not the others) using the “job_id” field
for each “job_id” value i update all other fields except overlap
let’s say i want to update “no_of_object”, “exclusive” and “non_exclusive” with the following job_id

{192: {'No_of_object': 2}}
{291: {'No_of_object': 5}}
{329: {'No_of_object': 8}}
{332: {'No_of_object': 6}}
{352: {'No_of_object': 8}}
{430: {'No_of_object': 13,
       'exclusive': 14,
       'non exclusive': -0.07692307692307693}}
{437: {'No_of_object': 13,
       'exclusive': 238,
       'non exclusive': -17.307692307692307}}
{441: {'No_of_object': 13,
       'exclusive': 24,
       'non exclusive': -0.8461538461538461}}
{445: {'No_of_object': 13,
       'exclusive': 103,
       'non exclusive': -6.923076923076923}}
{464: {'No_of_object': 10, 'exclusive': 3, 'non exclusive': 0.7}}
{465: {'No_of_object': 9}}
{466: {'No_of_object': 10}}
{467: {'No_of_object': 9, 'exclusive': 9, 'non exclusive': 0.0}}
{498: {'No_of_object': 9, 'exclusive': 9, 'non exclusive': 0.0}}
{538: {'No_of_object': 9}}
{9000: {'exclusive': 1}}

i found $[] but it seems that work only for one value at the time and not a list of value such as in my case

thank you for your help

1 Like

Thanks for reformatting your code.

Share what you tried with