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

ES5: Object.seal throws exception when run on a document

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.3.2
    • Component/s: JavaScript, Shell
    • None
    • ALL
    • Hide
      db.u.drop()
      db.u.insert({x:1})
      var x = db.u.findOne()
      Object.seal(x)
      

      throws

      Thu Jan 17 12:31:05.156 javascript execution failed (shell):1 TypeError: Cannot call method 'isConfigurable' of undefined
      Object.seal(x)
             ^
      

      Note: simply accessing each property of the document or iterating it before sealing is enough to prevent the error from occuring.

      
      

      db.u.drop()
      db.u.insert(

      {x:1}

      )
      var x = db.u.findOne()
      for (var p in x) {}
      Object.seal; // no longer throws

      Show
      db.u.drop() db.u.insert({x:1}) var x = db.u.findOne() Object .seal(x) throws Thu Jan 17 12:31:05.156 javascript execution failed (shell):1 TypeError: Cannot call method 'isConfigurable' of undefined Object .seal(x) ^ Note: simply accessing each property of the document or iterating it before sealing is enough to prevent the error from occuring. db.u.drop() db.u.insert( {x:1} ) var x = db.u.findOne() for (var p in x) {} Object.seal ; // no longer throws

          Assignee:
          benjamin.becker Ben Becker
          Reporter:
          aheckmann Aaron Heckmann
          Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

            Created:
            Updated:
            Resolved: