I am using the pymongo library in Python to update specific entries in my MongoDB, spesifically using the db.update_one() function which was previously working with the aggregation pipeline $set but now fails when using $addFields. I am trying to insert the entry:
'Client Facing': ['No']
into the object:
{
'Content Format': ['Presentation'],
'Category': ['Systems w/TPS'],
'Offering Market': ['Enterprise Linux Market'],
'Offering Portfolio': ['Enterprise Linux'],
'Offering Name': ['HANA excl L Systems - POWER9 H924 Scale-Out'],
'Keywords': ['SAP'],
'Language': ['English'],
'Additional Information': ['prepare-atl'],
'Organization Owner': ['Technology'],
'Brand': ['Cognitive Systems'],
'Content Owner Group': ['Technology - Systems']
}
So I was using the update_one() with the parameters: {'seismic_id': 12345} (this is the filter), and
{'$addFields': {'seismic_properties_obj.Client Facing': ['No']}}
However, when I do this it fails with the error:
pymongo.errors.WriteError: Unknown modifier: $addFields. Expected a valid update modifier or pipeline-style update specified as an array, full error: {'index': 0, 'code': 9, 'errmsg': 'Unknown modifier: $addFields. Expected a valid update modifier or pipeline-style update specified as an array'}