Apparent bug in logstash-output-mongodb plugin v 3.1.7 for logstash logstash-7.17.17

I recently migrated from mongodb 3.0 to mongodb 6.0 and logstash plugin 3.1.5 was no longer working, I upgraded the plugin to 3.1.7 and I keep getting this error in logstash logs:

n] MONGODB | Error checking 127.0.0.1:27017: ArgumentError: wrong number of arguments (given 2, expected 1)
n] MONGODB | Failed to handshake with 127.0.0.1:27017: ArgumentError: wrong number of arguments (given 2, expected 1)
n] MONGODB | Error checking 127.0.0.1:27017: ArgumentError: wrong number of arguments (given 2, expected 1)
n] MONGODB | Failed to handshake with 127.0.0.1:27017: ArgumentError: wrong number of arguments (given 2, expected 1)
n] MONGODB | Error checking 127.0.0.1:27017: ArgumentError: wrong number of arguments (given 2, expected 1)

Here's my logstash configuration:

input {
  file {
    path => "/home/shaigaut/logstash.log"
    type => "log"
  }
}


output {
  mongodb {
    collection => "testplugin"
    database => "iris"
    uri => "mongodb://127.0.0.1:27017"
    codec => json { }
  }
}

I've been reading about this error and it seems like a bug, would love to know if there is any workaround possible to connect logstash output to mongoDB

I would guess that this PR is related. Perhaps downgrade to 3.1.6?

This does not seem to fix the issue.

I downloaded logstash-output-mongodb: 3.1.7 from rubygems and reinstalled but no luck. See the same behavior with 3.1.6.