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

Positional Operator Matching Nested Arrays

    Details

      Description

      Issue Status as of Dec 06, 2016

      We recognize that this feature is highly requested by the community; we are investigating implementation approaches and considering designs for the required query language extensions in SERVER-27089. We appreciate the challenge of maintaining applications with schemas including large arrays, and the work described in SERVER-27089 includes this feature request as well as other related improvements to array update capabilities. Please feel free to review SERVER-27089 for additional details around the requirements of this work and watch it for updates.

      Original Description

      For cases where arrays can be nested within other arrays multiple levels deep, it would be great if the positional operator could match the appropriate array no matter how far deep the nesting goes. A syntax for this could be something like:

      collection.update(
        { "_id" : 1, "medications._id" : 23, "medications.prescriptions._id" : 77 },
        { $set : { "medications.$0.prescriptions.$1.quantity" : 30 } },
        false,
        true
      )
      

      Here is a link to a gist with a sample document. In our current application we actually nest as many as 5 levels deep and some cases, and would like to be able to do atomic updates on fields at the very bottom of the tree for efficiency.

      http://gist.github.com/342738

        Issue Links

          Activity

          Hide
          Guihgo Guihgo added a comment -

          2017 and nothing.. :

          Show
          Guihgo Guihgo added a comment - 2017 and nothing.. :
          Hide
          mercmobily Tony Mobily added a comment -

          I am taking bets. I put $20 that this will be here in 2019, open. Takers?

          Show
          mercmobily Tony Mobily added a comment - I am taking bets. I put $20 that this will be here in 2019, open. Takers?
          Hide
          Guihgo Guihgo added a comment -

          @Tony Mobily -> i think that better change to good and old MySQL hehehe

          Show
          Guihgo Guihgo added a comment - @Tony Mobily -> i think that better change to good and old MySQL hehehe
          Hide
          mercmobily Tony Mobily added a comment -

          Don't forget to place your bets!!

          Show
          mercmobily Tony Mobily added a comment - Don't forget to place your bets!!
          Hide
          Guihgo Guihgo added a comment - - edited

          at end, i 'm not using mysql.. I have to use embed collections and use agregate for get values from two collections... MONGODB IS THE BEST <3

          Show
          Guihgo Guihgo added a comment - - edited at end, i 'm not using mysql.. I have to use embed collections and use agregate for get values from two collections... MONGODB IS THE BEST <3

            People

            • Votes:
              340 Vote for this issue
              Watchers:
              270 Start watching this issue

              Dates

              • Created:
                Updated: