Please consider the code:

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


This follows this example: https://github.com/vibe-d/vibe.d/blob/master/examples/mongodb/source/app.d

This results in :

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

and in the Next line:

MongoCollection(vibe.db.mongo.client.MongoClient, 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

Reply via email to