Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Minor - P4 Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.2
    • Component/s: Write Ops
    • Labels:
      None
    • # Replies:
      12
    • Last comment by Customer:
      true
    • Documentation Changes:
      Completed

      Description

      Now that SERVER-991 is resolved, more can be accomplished with this if Mongo would maintain arrays sorted by specified field.

      Let's say the initial document state was:

      {a: [{version: 1, data: 10}]}
      

      After

      { $push : { a : { $each : [ { version : 3, data : 6 } ] , $orderBy : {version : -1 }, $trimTo : 11 } } }
      

      it will be

      {a: [{version: 2, data: 6}, {version: 1, data: 10}]}
      

      After

      { $push : { a : { $each : [ { version : 2, data : 8 } ] , $orderBy : {version : -1 }, $trimTo : 11 } } }
      

      it will be

      {a: [{version: 3, data: 6}, {version: 2, data: 8}, {version: 1, data: 10}]}
      

      In this case,
      Mongo maintains array in "a" sorted by version in discending order and
      trims the array to 11 elements by dropping the very last element when
      required.

      The context here is that this mechanism would enable capability similar to
      http://hbase.apache.org/book/versions.html

        Issue Links

          Activity

          Hide
          auto (Inactive)
          added a comment -

          Author:

          {u'date': u'2013-01-14T04:16:36Z', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'}

          Message: SERVER-8008 Moved checks for sort pattern to early and performed them only once per update.
          Branch: master
          https://github.com/mongodb/mongo/commit/503672094dcc6370bc015638cc36c0a306cf2996

          Show
          auto (Inactive)
          added a comment - Author: {u'date': u'2013-01-14T04:16:36Z', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'} Message: SERVER-8008 Moved checks for sort pattern to early and performed them only once per update. Branch: master https://github.com/mongodb/mongo/commit/503672094dcc6370bc015638cc36c0a306cf2996
          Hide
          auto (Inactive)
          added a comment -

          Author:

          {u'date': u'2013-01-15T22:53:57Z', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'}

          Message: SERVER-8008 Fixed uassert numbers.
          Branch: master
          https://github.com/mongodb/mongo/commit/09139c400d9fe5a6a0d19764395f22b4333e761f

          Show
          auto (Inactive)
          added a comment - Author: {u'date': u'2013-01-15T22:53:57Z', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'} Message: SERVER-8008 Fixed uassert numbers. Branch: master https://github.com/mongodb/mongo/commit/09139c400d9fe5a6a0d19764395f22b4333e761f
          Hide
          Yuri Finkelstein
          added a comment -

          Thanks for making this happen. This is a great feature, but perhaps it would require a bit more effort to explain folks what can be done with it. This is in fact a perfect instrument for MVCC-type writes against Mongo. Also, many messaging systems do not guarantee in-order delivery. So, if a user app is storing data to mongo in response to message receipt but needs to order the result in some way (by timestamp, sequence counter, etc) it now can do it with this instrument. Ability to trim the array is paramount to avoid unbounded document growth. I think you need to publicize what these interesting potential applications of this feature.

          Show
          Yuri Finkelstein
          added a comment - Thanks for making this happen. This is a great feature, but perhaps it would require a bit more effort to explain folks what can be done with it. This is in fact a perfect instrument for MVCC-type writes against Mongo. Also, many messaging systems do not guarantee in-order delivery. So, if a user app is storing data to mongo in response to message receipt but needs to order the result in some way (by timestamp, sequence counter, etc) it now can do it with this instrument. Ability to trim the array is paramount to avoid unbounded document growth. I think you need to publicize what these interesting potential applications of this feature.
          Hide
          Alberto Lerner (Inactive)
          added a comment -

          Yuri, when can we read your g+ post about those usage cases?

          Show
          Alberto Lerner (Inactive)
          added a comment - Yuri, when can we read your g+ post about those usage cases?
          Hide
          Yuri Finkelstein
          added a comment - - edited

          What's g+? Google plus? I barely use it. I can talk about this at MongoSF later this year.

          Show
          Yuri Finkelstein
          added a comment - - edited What's g+? Google plus? I barely use it. I can talk about this at MongoSF later this year.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                1 year, 49 weeks, 2 days ago
                Date of 1st Reply: