MongoDB and vibe troubles.

seany seany at
Thu Feb 9 22:16:16 UTC 2023

Please consider the code:

         mClient = connectMongoDB("");
         auto db     = mClient.getDatabase("webAppMaster");
         auto users  = db["users"];

This follows this example:

This results in :

         MongoDatabase("webAppMaster", "webAppMaster.$cmd", 

and in the Next line:

MongoDatabase("webAppMaster", "webAppMaster.$cmd", 
vibe.db.mongo.client.MongoClient), "users", "webAppMaster.users")

This makes me think that MongoDB driver has successfully found 
the database and the collection. But now, this line is causing a 
problem :

         auto result = users.findOne(["_id": userName, "password" 
: passHash]);

The error is, seen on the web page i am trying to serve:

vibe.db.mongo.connection.MongoDriverException@/root/.dub/packages/vibe-d-0.9.5/vibe-d/mongodb/vibe/db/mongo/cursor.d(304): Query failed. Does the database ex

and on the root console where vibe.d is running i have this :

         MongoDB reply was longer than expected, skipping the 
rest: 223 vs. 36

The database and collection exists:

     > mongosh
     > use webAppMaster
     > db.webAppMaster.users.findOne({"_id": "testuser", 
"password" : "1234"})

shows me what I want to see.

Where do I start debugging, please? Thank you

More information about the Digitalmars-d-learn mailing list