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

BSON field 'profile.sampleRate' is the wrong type 'int', expected type 'double'

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.6.2
    • Affects Version/s: None
    • Component/s: Shell API
    • None
    • Environment:
      MacOS
      Mongosh v1.3.1
      MongoDB v4.0 & v4.4
    • 1
    • Not Needed
    • Iteration Porpoise, Iteration Quahog

      Problem Statement/Rationale


      Mongosh cannot process the commands below

      test> db.setProfilingLevel(0, { slowms: 100, sampleRate: 1})
      MongoServerError: BSON field 'profile.sampleRate' is the wrong type 'int', expected type 'double'
      
      test> db.setProfilingLevel(0, { slowms: 100, sampleRate: 1.0})
      MongoServerError: BSON field 'profile.sampleRate' is the wrong type 'int', expected type 'double'
      

      Steps to Reproduce

      Run the command

      test> db.setProfilingLevel(0, { slowms: 100, sampleRate: 1})

      Expected Results

      db.setProfilingLevel(0, { slowms: 100, sampleRate: 1})
      { was: 0, slowms: 100, sampleRate: 1, ok: 1 }
      

      Actual Results

      test> db.setProfilingLevel(0, { slowms: 100, sampleRate: 1})
      MongoServerError: BSON field 'profile.sampleRate' is the wrong type 'int', expected type 'double'
      

      Additional Notes

      It works if I convert 1 or 1.0 to double using Double()

      test> db.setProfilingLevel(0, { slowms: 100, sampleRate: Double(1)})
      { was: 0, slowms: 100, sampleRate: 1, ok: 1 }
      

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            raymond.hu@mongodb.com Raymond Hu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: