error connecting to mongodb atlas with vibe.d

Arjan arjan at ask.me.to
Sun May 1 21:13:28 UTC 2022


On Saturday, 30 April 2022 at 14:29:56 UTC, notsteve wrote:
> Hi,
>
> I am trying to setup a simple webserver in D using vibe.d 
> (0.9.4) and want to use mongoDB as a database. To achieve this, 
> I've set up a mongoDB atlas instance with the following command 
> inside the standard app.d file created by vibe.d
>
> ```
>  string MongoURL = 
> "mongodb://username:<password>@cluster0-shard-00-01.gaetq.mongodb.net:27017";
>
>     auto client = connectMongoDB(MongoURL);
>
> ```
>
> but am getting error [1] below.
>
> Alternatively if I use the following path to the instance
>
> ```
>     string MongoURL =       
> "mongodb://username:password@cluster0-shard-00-01.gaetq.mongodb.net:27017/myFirstDatabase?ssl=true&sslverifycertificate=false";
>
> ```
>
> I get error [2].
>
> I have tried accessing this instance using other programming 
> languages and am not having any issues so am sure it is not an 
> issue with the database instance. Does anyone have experience 
> with this?
>
>
>
> Error 1:
> ```
> object.Exception at ../../../.dub/packages/vibe-core-1.22.3/vibe-core/source/vibe/core/net.d(777): Reached end of stream while reading data.
> ----------------
> ```

https://github.com/vibe-d/vibe-core/blob/v1.22.3/source/vibe/core/net.d#L777

Apparently, no data is received anymore within the remaining time 
duration.

>
>
>
> Error 2:
> ```
> object.Exception at ../../../.dub/packages/vibe-d-0.9.4/vibe-d/data/vibe/data/bson.d(813): BSON value is type 'int_', expected to be one of [double_]
> ```

https://github.com/vibe-d/vibe.d/blob/v0.9.4/data/vibe/data/bson.d#L813

There is clearly something wrong with the type expected and 
provided. Check the schemes/layouts.



More information about the Digitalmars-d-learn mailing list