michaelklishin/monger

Serverless Mongo (Atlas) is not supported = A TXT record is only permitted to contain the keys [authsource, replicaset]

ZivotJeKrasny opened this issue · 1 comments

I found that connecting to MongoDB Serverless Atlas cluster is not supported by the used mongo driver.

(ns my-namespace (:require [monger.core :as mg]))
(let [uri "mongodb+srv://dbUser:pswd@hostname.tbtin.mongodb.net/db?retryWrites=true&w=majority"
      {:keys [conn db]} (mg/connect-via-uri uri)])
Execution error (MongoConfigurationException) at com.mongodb.ConnectionString/<init> (ConnectionString.java:388).
A TXT record is only permitted to contain the keys [authsource, replicaset], but the TXT record for 'hostname.tbtin.mongodb.net' contains the keys [loadbalanced, authsource]
dig hostname.tbtin.mongodb.net TXT

; <<>> DiG 9.18.1-1ubuntu1.1-Ubuntu <<>> hostname.tbtin.mongodb.net TXT
;; ANSWER SECTION:
hostname.tbtin.mongodb.net. 60 IN TXT "authSource=admin&loadBalanced=true"

I think the solution is to use a newer version of mongo driver org.mongodb/mongodb-driver-core "4.7.1" ? https://mvnrepository.com/artifact/org.mongodb/mongodb-driver-core
Right?

I have the same problem unfortunately.