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

Duplicate keys in stored and shell object

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.4.1
    • None
    • JavaScript, Shell
    • 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 }

    Description

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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: