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

Duplicate keys in stored and shell object

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.1
    • Component/s: JavaScript, Shell
    • Environment:
      Windows 7x64, Ubuntu 10.04x32
    • ALL
    • Hide

      Try it in shell:
      > db.test.insert({g: 1, y: {"1890" : 2, "1967" : 1, "1986" : 1, "1965" : 1)
      > var yy = db.test.findOne(

      {g: 1}

      ).y; printjson(yy); yy['1961'] = 1; printjson(yy);}}

      In 2.2.0 output:

      { "1890" : 2, "1967" : 1, "1986" : 1, "1965" : 1 } { "1890" : 2, "1967" : 1, "1986" : 1, "1965" : 1, "1961" : 1 }

      In 2.4.1 output

      { "1890" : 2, "1965" : 1, "1967" : 1, "1986" : 1 }

      {
      "1961" : 1,
      "1890" : 2,
      "1965" : 1,
      "1967" : 1,
      "1986" : 1,
      "1961" : 1
      }

      Show
      Try it in shell: > db.test.insert({g: 1, y: {"1890" : 2, "1967" : 1, "1986" : 1, "1965" : 1 ) > var yy = db.test.findOne( {g: 1} ).y; printjson(yy); yy ['1961'] = 1; printjson(yy);}} In 2.2.0 output: { "1890" : 2, "1967" : 1, "1986" : 1, "1965" : 1 } { "1890" : 2, "1967" : 1, "1986" : 1, "1965" : 1, "1961" : 1 } In 2.4.1 output { "1890" : 2, "1965" : 1, "1967" : 1, "1986" : 1 } { "1961" : 1, "1890" : 2, "1965" : 1, "1967" : 1, "1986" : 1, "1961" : 1 }

      Shell write keys to object twice. Moreover, double keys can be stored in the database.

            Assignee:
            Unassigned Unassigned
            Reporter:
            klimashkin Paul Klimashkin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: