#1 2020-03-30 20:57:09

marcolanger
Member
Registered: 2019-08-02
Posts: 5

Erro while connecting to Atlas MongoDB

I'm trying to connect to an Atlas MongoDB server using a simples authentication, but i got a error after when calling 'OpenAuth' method.

My code.
Client := TMongoClient.Create('shard00',27017);
DB := Client.OpenAuth('admin','usr','pass');

The error happens at this method:
procedure TMongoClient.AfterOpen;
begin
if VarIsEmptyOrNull(fServerBuildInfo) then begin
fConnections[0].RunCommand('admin','buildinfo',fServerBuildInfo);
with _Safe(fServerBuildInfo)^.A['versionArray']^ do
if Count=4 then
fServerBuildInfoNumber := // e.g. 2040900 for MongoDB 2.4.9
integer(Values[0])*1000000+integer(Values[1])*10000+
integer(Values[2])*100+integer(Values[3]);
end;
end;


I got the updated version

Error message: Server did reset the connection: probably due to a bad formatted BSON request -> close socket

Offline

#2 2020-03-30 22:02:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Erro while connecting to Atlas MongoDB

Something changed with latest MongoDB 4.x which reject our requests.
It works fine with MongoDB 2.x or MongoDB 3.x.

I don't know yet what's wrong.

Offline

#3 2020-05-20 19:33:01

marcolanger
Member
Registered: 2019-08-02
Posts: 5

Re: Erro while connecting to Atlas MongoDB

Has anyone managed to find the cause of this problem?

if i connect without authentication it works, however if i connect using simple authentication it breaks.

Offline

#4 2020-06-12 09:17:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Erro while connecting to Atlas MongoDB

I just fixed a protocol problem by https://synopse.info/fossil/info/0aba463a6d
smile

But I still have issues with the authentication.
I guess something was also changed with MongoDB 4.x about default authentication parameters.
Investigating...
sad

Edit: please check https://synopse.info/fossil/info/fd93a93e5e

Offline

Board footer

Powered by FluxBB