[SERVER-52622] Unable to use ArrayFilters option with stitch_support_v1_update_create Created: 04/Nov/20  Updated: 27/Oct/23  Resolved: 18/Nov/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Kush Patel Assignee: Jacob Evans
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

Create a collection with the sample document in the description

attempt to call stitch_support_v1_update_create with the sample parameters from the operations in the description

Sprint: Query 2020-11-30
Participants:

 Description   

I am using the Realm Go backend (with cgo) to call stitch_support_v1_update_create with an arrayFilters option but I keep see the following error every time:

{No array filter found for identifier 'element' in path 'grades.$[element]'}]}

I have a collection with a single document as such:

{ "_id" : 1, "grades" : [ 95, 92, 190 ] }

and am trying to run the following operation:

collection.updateOne(   { },   { $set: { "grades.$[element]" : 100 } },   {      arrayFilters: [ { "element": 190 } ]   })

Operations without an arrayFilter work property but I also get the correct error when I pass in multiple array filters with the correct name e.g.

collection.updateOne(   { },   { $set: { "grades.$[element]" : 100 } },   {      arrayFilters: [ { "element": 190 }, { "element": 180 } ]   })

gives:

Found multiple array filters with the same top-level field name element

The arrayFilter bytes sent to stitch_support_v1_update_create seem to be correct, and the filters seem to get parsed correctly, but something appears to be off when the update tries to find the appropriate filter



 Comments   
Comment by Jacob Evans [ 18/Nov/20 ]

After some investigation we determined that there was no bug on the library side, just an argument not making it to stitch_support_v1_update_create.

Comment by Nicholas Zolnierz [ 04/Nov/20 ]

Spoke briefly with kush.patel on this, we have a very basic unit test for arrayFilters but its possible that it's not actually testing what was intended.

Generated at Thu Feb 08 05:28:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.