Error establishing direct connection to mongo node at [ip:port]. Error output: no reachable servers

Hi,

I am using MongoDB with a replica set. When I am trying to create a metricbeat MongoDB module am not sure How to give a URL. I don't understand how to solve it. when uncommenting the ssl.verification_mode: 'none' then getting "no reachable servers error". if you comment the ssl.verification_mode: 'none' then getting saslcontinue.mechanism error.

metricbeat version: 7.11.1
mongodb: 5.0

#ssl.verification_mode: 'none'
mongodb/mongodb.go:98 Error establishing direct connection to mongo node at [ip:27017]. Error output: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.
module/wrapper.go:259 Error fetching data for metricset mongodb.status: error creating new Session: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.

ssl.verification_mode: 'none':

"error": {
"message": "error creating new Session: no reachable servers"
},

Can you post your config file, please?

Also, can you try with a previous version of Mongodb? I don´t discard that Beats doesn´t support 5.0 yet.

- module: mongodb
  metricsets:
    #- dbstats
    - status
    #- collstats
    - metrics
    - replstatus
  period: 10s

  # The hosts must be passed as MongoDB URLs in the format:
  # [mongodb://][user:pass@]host[:port].
  # The username and password can also be set using the respective configuration
  # options. The credentials in the URL take precedence over the username and
  # password configuration options.
  hosts: ["mongodb://ip:27017?authMechanism=SCRAM-SHA-256&authSource=admin"]

  # Optional SSL. By default is off.
  #ssl.enabled: true

  # Mode of verification of server certificate ('none' or 'full')
  #ssl.verification_mode: 'none'

  # List of root certificates for TLS server verifications
  #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]

  # Certificate for SSL client authentication
  #ssl.certificate: "/etc/pki/client/cert.pem"

  # Client Certificate Key
  #ssl.key: "/etc/pki/client/cert.key"

  # Username to use when connecting to MongoDB. Empty by default.
  username: beats

  # Password to use when connecting to MongoDB. Empty by default.
  password: xxxxxx

@Mario_Castro ?