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

Multiple $slice on fixed sized array causes wrong/duplicate elements

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: 2.3.2
    • Fix Version/s: None
    • Component/s: Write Ops
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      db.fs.update(

      {x:4}

      ,{ $push : { y : { $each : [

      {a:5}

      ,

      {a:1}

      ,

      {a:4}

      ,

      {a:2}

      ,

      {a:3}

      ], $slice:-4, $slice:-3, $sort:

      {a:1}

      } } })

      db.fs.find()
      { "_id" : ObjectId("50fd0989a8f4e3eef998f845"), "x" : 4, "y" : [

      { "a" : 4 }

      ,

      { "a" : 4 }

      ,

      { "a" : 5 }

      ] }

      Show
      db.fs.update( {x:4} ,{ $push : { y : { $each : [ {a:5} , {a:1} , {a:4} , {a:2} , {a:3} ], $slice:-4, $slice:-3, $sort: {a:1} } } }) db.fs.find() { "_id" : ObjectId("50fd0989a8f4e3eef998f845"), "x" : 4, "y" : [ { "a" : 4 } , { "a" : 4 } , { "a" : 5 } ] }

      Description

      Doing a $push with multiple $slice for fixed sized arrays causes wrong/duplicate elements.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sam.weaver Sam Weaver
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: