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

strings with embedded nulls cannot be retrieved correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 1.8.2, 1.9.2
    • None
    • Internal Code
    • None
    • Tested on Vista
    • ALL

    Description

      For QA-3, attempted to verify SERVER-1300 using the following:

      db = db.getSiblingDB("qadb");

      db.mns.drop();
      db.mns.save(

      {i: 1, s:'abcdefghijklmnopqrstuvwxyz'}

      );
      db.mns.save(

      {i: 2, s:'abcde\0fghijklmnopqrstuvwxyz'}

      );
      db.mns.save(

      {i: 3, s:'abcdefghijklm\0nopqrstuvwxyz'}

      );
      db.mns.save(

      {i: 4, s:'abcdefghijklm\0nopqrssuvwxyz'}

      );
      db.mns.save(

      {i: 5, s:'abcdefghijklmnopqrst\0uvwxyz'}

      );
      db.mns.save(

      {i: 6, s:'abcdefghijklmnopqrstuvwx\0yz'}

      );
      db.mns.ensureIndex(

      {s: 1}

      );

      var r = db.mns.find().sort(

      {s:1}

      );

      The result in 1.9.2 is

      > r

      { "_id" : ObjectId("4e4a97d2f1c165e78e8abf66"), "i" : 2, "s" : "abcde" } { "_id" : ObjectId("4e4a97d2f1c165e78e8abf68"), "i" : 4, "s" : "abcdefghijklm" } { "_id" : ObjectId("4e4a97d2f1c165e78e8abf67"), "i" : 3, "s" : "abcdefghijklm" } { "_id" : ObjectId("4e4a97d2f1c165e78e8abf69"), "i" : 5, "s" : "abcdefghijklmnop qrst" } { "_id" : ObjectId("4e4a97d2f1c165e78e8abf6a"), "i" : 6, "s" : "abcdefghijklmnop qrstuvwx" } { "_id" : ObjectId("4e4a97d2f1c165e78e8abf65"), "i" : 1, "s" : "abcdefghijklmnop qrstuvwxyz" }

      Since we can't retrieve these strings, what's the point of worrying about the sort?

      Note this isn't a JavaScript issue, because you can create such strings and get them in the shell:
      > a = 'abcdef\0ghijklm'
      abcdef ghijklm
      > a
      abcdef ghijklm
      >

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dan@mongodb.com Daniel Pasette (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: