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

$push allows BSON object to exceed 4MB

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.3.3
    • Affects Version/s: 1.3.2
    • Component/s: None
    • None

      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

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

              Created:
              Updated:
              Resolved: