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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Won't Fix
    • 2.3.2
    • None
    • 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

    Attachments

      Issue Links

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: