Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-52622

Unable to use ArrayFilters option with stitch_support_v1_update_create

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • ALL
    • Hide

      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

      Show
      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
    • Query 2020-11-30

      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

            Assignee:
            jacob.evans@mongodb.com Jacob Evans
            Reporter:
            kush.patel@mongodb.com Kush Patel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: