Update many items inside an array through Data API or Atlas Functions

Hi everyone,

I have a micro-services application, and I’m migrating it from MongoDB driver to Data API or Custom HTTPS Endpoints to avoid the CPU cost of authenticating every time the micro-service is executed.

I have an update function that uses the filtered positional operator to update all elements inside an array that matches the arrayFilters criteria. If we check the updateOne implementation in the Data API, there is no argument or option to provide the arrayFilter. I also checked the implementation of updateOne through Atlas Function for the case of a Custom HTTPS Endpoint, but its option argument doesn’t support arrayFilters either.

Does anyone have a possible solution for this situation? The only one that I could think of so far was to implement my own Data API Server on a cloud provider.

Hi @Artur_57972,

The custom HTTP endpoint function supports the arrayFilters in the update query!

Can you please share the update query and the error you are seeing?

1 Like

Hi @turivishal ,

I’ve just tested it, and it works. Thanks for your time and help!

1 Like