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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 2.3.2
    • Fix Version/s: None
    • Component/s: JavaScript, Shell
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      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

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: