Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1414

ObjectId methods valueOf() and str return undefined

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 1.8.0
    • No version
    • Shell API
    • None
    • OSX/brew
    • Not Needed

    Description

      Problem Statement/Rationale

      It appears a regression has been introduced on the mongosh helper methods on ObjectId() for valueOf() and str.

      The str getter doesn't list at all in the prototype, and calling either str or valueOf() returns undefined.

      Steps to Reproduce

      mongosh

      // str test
      typeof new ObjectId().str;
      // valueOf() test
      typeof new ObjectId().valueOf();
      // toHexString() test
      typeof new ObjectId().toHexString();
      

      Expected Results

      mongosh

      // str test
      typeof new ObjectId().str;
      string
      // valueOf() test
      typeof new ObjectId().valueOf();
      string
      // toHexString() test
      typeof new ObjectId().toHexString();
      string
      

      Actual Results

      mongosh

      // str test
      typeof new ObjectId().str;
      undefined
      // valueOf() test
      typeof new ObjectId().valueOf();
      undefined
      // toHexString() test
      typeof new ObjectId().toHexString();
      string
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              luke.prochazka@mongodb.com Luke Prochazka
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: