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

Setting assoc array properties doesn't work

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Shell
    • None

    Description

      Adding a new field fails:

      > p=db.playlists.findOne()
      {"_id" : "4a4270125fac18127c8c858c" , "songlist" : [

      {"$ref" : "x.y" , "$id" : 6}

      ]}
      > p.username = "me"
      me
      > p
      {"_id" : "4a4270125fac18127c8c858c" , "songlist" : [

      {"$ref" : "x.y" , "$id" : 6}

      ] , "username" : "me"}
      > db.playlists.save(p)
      > p=db.playlists.find()
      {"_id" : "4a4270125fac18127c8c858c" , "songlist" : [

      {"$ref" : "x.y" , "$id" : 6}

      ]}

      Trying it another way gives a more disastrous result:

      > x = db.playlists.findOne()
      {"_id" : "4a4270125fac18127c8c858c" , "songlist" : [

      {"$ref" : "x.y" , "$id" : 6}

      ]}
      > x["username"] = "me"
      Wed Jun 24 14:32:23 JS Error: SyntaxError: missing ] in index expression (shellhelp1):0
      Wed Jun 24 14:32:23 User Exception (shellhelp1) exec failed
      terminate called after throwing an instance of 'mongo::UserException'
      what(): (shellhelp1) exec failed
      Wed Jun 24 14:32:23 mongo got signal 6 (Aborted), stack trace:
      Wed Jun 24 14:32:23 0x8056acd 0xb7f0c400 0xb7f0c430 0xb7b2c8a0 0xb7b2e268 0xb7ea9778 0xb7ea7655 0xb7ea7692 0xb7ea77ca 0x8080e43 0x808ee1a 0x80587e8 0xb7b17685 0x8056401
      mongo(_Z12quitAbruptlyi+0x43d) [0x8056acd]
      [0xb7f0c400]
      [0xb7f0c430]
      /lib/tls/i686/cmov/libc.so.6(gsignal+0x50) [0xb7b2c8a0]
      /lib/tls/i686/cmov/libc.so.6(abort+0x188) [0xb7b2e268]
      /usr/lib/libstdc++.so.6(ZN9gnu_cxx27_verbose_terminate_handlerEv+0x158) [0xb7ea9778]
      /usr/lib/libstdc++.so.6 [0xb7ea7655]
      /usr/lib/libstdc++.so.6 [0xb7ea7692]
      /usr/lib/libstdc++.so.6 [0xb7ea77ca]
      mongo [0x8080e43]
      mongo [0x808ee1a]
      mongo [0x80587e8]
      /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5) [0xb7b17685]
      mongo [0x8056401]

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            kristina Kristina Chodorow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: