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

$push allows BSON object to exceed 4MB

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Done
    • 1.3.2
    • 1.3.3
    • None
    • None

    Description

      Growing an object size through the use of $push doesn't trigger the 4MB object limit error.

      JS shell session that creates an object of 5MB, by $push ing 1MB strings onto an array:

      > s = "x"
      > for(i = 0; i < 20; i++) s += s
      > s.length // 1MB string
      1048576
      > db.test.remove()
      > db.test.insert(

      {a:[]}

      )
      ObjectId("4b83590a8f668d84b215eaa5")
      > for(i = 0; i < 5; i++) db.test.update({}, {$push: {a:s}}) // push 5 times = ~5 MB object size
      > db.test.findOne().a.length
      5
      > db.getLastError()
      null

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            goosmurf Yun Huang Yong
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: