Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2017

Return value of Database#command incorrectly documented

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 2.11.2, 2.12.0.rc0
    • Docs
    • None
    • Fully Compatible

    Description

      Our api documentation at https://api.mongodb.com/ruby/current/Mongo/Database.html#command-instance_method states that Database#command returns a hash, but it actually returns an Operation::Result:

      irb(main):015:0> pp Band.collection.database.command(ismaster:1)
      #<Mongo::Operation::Result:0x47158564333900 documents=[{"hosts"=>["localhost:14420", "localhost:14421", "localhost:14422"], "setName"=>"ruby-driver-rs", "setVersion"=>1, "ismaster"=>true, "secondary"=>false, "primary"=>"localhost:14420", "me"=>"localhost:14420", "electionId"=>BSON::ObjectId('7fffffff0000000000000001'), "lastWrite"=>{"opTime"=>{"ts"=>#<BSON::Timestamp:0x000055c7eaf36968 @seconds=1574115607, @increment=1>, "t"=>1}, "lastWriteDate"=>2019-11-18 22:20:07 UTC, "majorityOpTime"=>{"ts"=>#<BSON::Timestamp:0x000055c7eaf367d8 @seconds=1574115607, @increment=1>, "t"=>1}, "majorityWriteDate"=>2019-11-18 22:20:07 UTC}, "maxBsonObjectSize"=>16777216, "maxMessageSizeBytes"=>48000000, "maxWriteBatchSize"=>100000, "localTime"=>2019-11-18 22:20:08 UTC, "logicalSessionTimeoutMinutes"=>30, "connectionId"=>1025, "minWireVersion"=>0, "maxWireVersion"=>8, "readOnly"=>false, "ok"=>1.0, "$clusterTime"=>{"clusterTime"=>#<BSON::Timestamp:0x000055c7eaf36440 @seconds=1574115607, @increment=1>, "signature"=>{"hash"=><BSON::Binary:0x47158564336020 type=generic data=0x0000000000000000...>, "keyId"=>0}}, "operationTime"=>#<BSON::Timestamp:0x000055c7eaf362b0 @seconds=1574115607, @increment=1>}]>
      => #<Mongo::Operation::Result:0x47158564333900 documents=[{"hosts"=>["localhost:14420", "localhost:14421", "localhost:14422"], "setName"=>"ruby-driver-rs", "setVersion"=>1, "ismaster"=>true, "secondary"=>false, "primary"=>"localhost:14420", "me"=>"localhost:14420", "electionId"=>BSON::ObjectId('7fffffff0000000000000001'), "lastWrite"=>{"opTime"=>{"ts"=>#<BSON::Timestamp:0x000055c7eaf36968 @seconds=1574115607, @increment=1>, "t"=>1}, "lastWriteDate"=>2019-11-18 22:20:07 UTC, "majorityOpTime"=>{"ts"=>#<BSON::Timestamp:0x000055c7eaf367d8 @seconds=1574115607, @increment=1>, "t"=>1}, "majorityWriteDate"=>2019-11-18 22:20:07 UTC}, "maxBsonObjectSize"=>16777216, "maxMessageSizeBytes"=>48000000, "maxWriteBatchSize"=>100000, "localTime"=>2019-11-18 22:20:08 UTC, "logicalSessionTimeoutMinutes"=>30, "connectionId"=>1025, "minWireVersion"=>0, "maxWireVersion"=>8, "readOnly"=>false, "ok"=>1.0, "$clusterTime"=>{"clusterTime"=>#<BSON::Timestamp:0x000055c7eaf36440 @seconds=1574115607, @increment=1>, "signature"=>{"hash"=><BSON::Binary:0x47158564336020 type=generic data=0x0000000000000000...>, "keyId"=>0}}, "operationTime"=>#<BSON::Timestamp:0x000055c7eaf362b0 @seconds=1574115607, @increment=1>}]>
      

      Attachments

        Activity

          People

            alex.bevilacqua@mongodb.com Alex Bevilacqua
            oleg.pudeyev@mongodb.com Oleg Pudeyev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: