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

ObjectId to String type conversion different in 2.2 from 2.0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.2.0
    • Fix Version/s: None
    • Component/s: JavaScript
    • Labels:
      None
    • Operating System:
      ALL

      Description

      The type conversion from ObjectId to String is invalid compared to previous MongoDB versions.

      In Mongo 2.0.x:

      var oid = new ObjectId("50575c152c2414982d000003");
      var oidAsString = String(oid);
      print(typeof oidAsString); // string
      print(oidAsString); // 50575c152c2414982d000003

      In Mongo 2.2.x:

      var oid = new ObjectId("50575c152c2414982d000003");
      var oidAsString = String(oid);
      print(typeof oidAsString); // string
      print(oidAsString); // ObjectId("50575c152c2414982d000003")

      I would expect the converted value to be the hex string as described in 2.0.x.

      This issue is similar to SERVER-5439, however, this is not an improvement but a bug.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tad Tad Marshall
              Reporter:
              jgornick Joe Gornick
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: