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

Duplicate keys in stored and shell object

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.4.1
    • Fix Version/s: None
    • Component/s: JavaScript, Shell
    • Labels:
    • Environment:
      Windows 7x64, Ubuntu 10.04x32
    • Operating System:
      ALL
    • Steps To Reproduce:
      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 }

      Description

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: