function getInstanceAttributeParameters(shim, mongo) {
  let params
  if (mongo?.s?.topology) {
    shim.logger.trace('Adding datastore instance attributes from mongo.s.db + mongo.s.topology')
    const databaseName = mongo?.s?.db?.databaseName || mongo?.s?.namespace?.db || null
    const topology = mongo.s.topology
    params = getParametersFromTopology(topology, databaseName)
  } else if (mongo?.s?.db?.s?.client?.s?.options?.hosts?.length) {
    const databaseName = mongo?.s?.db?.databaseName || null
    const hosts = mongo.s.db.s.client.s.options.hosts
    params = getParametersFromHosts(hosts, databaseName)
  } else if (mongo?.s?.db?.client?.topology) {
    const databaseName = mongo?.s?.namespace?.db
    const topology = mongo.s.db.client.topology
    params = getParametersFromTopology(topology, databaseName)
  } else {
    shim.logger.trace('Could not find datastore instance attributes.')
    params = new DatastoreParameters()
  }

  return params
}
Get the database_name, host, port_path_or_id
for the query segment. v4 refactored where the topology is stored.
You can now get the details via the client obj that's deeply nested
See: https://github.com/mongodb/node-mongodb-native/pull/2594/files#diff-1d214e57ddda9095d296e5700ebce701333bfefcf417e234c584d14091b2f50dR168

@param {Shim} shim instance of shim
@param {object} mongo instance of mongo
@returns {object} db params