I am trying to connect to remote mongodb server from another server.
remote mongodb version: 5.0.8
remote mongodb tools version: 100.5.1
when I am trying to connect to the db using old mongodb driver then it throws following error:
server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.
connection function:
import (
"gopkg.in/mgo.v2"
)
func ConnectDb() (mongoSession *mgo.Session) {
mongoDBDialInfo := &mgo.DialInfo{
Addrs: []string{ThemeDatabaseIpPort},
Username: ThemeDbUsername,
Password: ThemeDbPassword,
Database: "admin",
Timeout: 60 * time.Second,
PoolLimit: 4096,
}
mongoSession, err := mgo.DialWithInfo(mongoDBDialInfo)
if err != nil {
fmt.Printf("CreateSessionForThemeDB: %s\n", err)
defer mongoSession.Close()
return mongoSession
}
mongoSession.SetMode(mgo.Monotonic, true)
return mongoSession
}