We are using Appian's MongoDB connected system. In our integration object we are using "Update One in Collection" operation to update a specific element of an Array of Documents.
Below are the Filter JSON, Update Instructions JSON and Error Message
--- Filter JSON ---
a!toJson( { '$and': { { { "_id": { '$oid': "6407f59c20f85f4027c3655b" } } } } } )
--- Update Instructions JSON ---
a!toJson( { '$set': { "form_schedule.$[elem].formName.oldValue": "forms old value 1" }, '$arrayFilters':{ m_field( "elem.amendmentComments", m_eq( "Rk Form Number" ) ) } } )
--- ERROR MESSAGE --
Mongo Write Exception error-result-guidance Write operation error on server serff-develop-shard-00-02.ylpdg.mongodb.net:27017. Write error: WriteError{code=2, message='No array filter found for identifier 'elem' in path 'form_schedule.$[elem].formName.oldValue'', details={}}.
Discussion posts and replies are publicly visible
Seems that this expression form_schedule.$[elem].formName.oldValue is returning a does not return anything, so Mongo cannot make any update.
Could you check the contents of the array?
Hi Array does contains data. form_schedule.formName.oldValue also have valid data in it.
OK vishwv0002 , but could be that the filter you are aplying does not return any element, even when the array contains data?