arrayFilters with $<identifier> not working in stitch

I’m working on a function in MongoDB Stitch and I’m having an error when I try to update multiple documents in an array. I’m using an arrayFilter and $ operator.
The error I’m getting is the following:

StitchError: No array filter found for identifier ‘elem’ in path ‘streams.$[elem].pickup_point_id’

And this is the function:

return locatCollection.findOneAndUpdate({_id: res._id} ,
{

           $set: {
             "streams.$[elem].pickup_point_id": "",
           _modified:  new Date()
          }
        },
        {
          multi: true,
          arrayFilters: [ { "elem.pickup_point_id": pickup_point_id } ], //pickup_point_id is sent in arguments and it's working fine for everything else
        }
          )

Hi @Juan_Amaral, welcome!

Unfortunately arrayFilters is currently not supported. There’s an open canny https://mongodb.canny.io/mongodb-stitch/p/arrayfilters for this operator to be added. Please feel free to up-vote to get notifications on request.

Regards,
Wan.

Thanks for the answer, is currently unsupported for stitch only? When I was trying this in stitch I also tried it in mongo shell and it worked just fine.

Hi @Juan_Amaral,

Yes, that’s correct. The canny link above is only for MongoDB Stitch.

In regards to MongoDB server arrayFilters with $<identifier> operator has been available since MongoDB v3.6+.

Regards,
Wan.