Am Thu, 21 May 2015 14:13:10 +0200
schrieb Marc Schütz schuetzm@gmx.net:

I'm getting a strange exception when calling ensureIndex():

vibe.db.mongo.connection.MongoDriverException@../../../d/vibe.d/source/vibe/db/mongo/connection.d(270):
BSON value is type 'null', expected to be one of [int]

After some investigation, it seems that MongoDB has a problem with
getLastError. I'm outputting the error return value as JSON at
source/vibe/db/mongo/connection.d:262, and this is what I get:

getLastError: {"ok":0,"bad
cmd":{"w":1,"getLastError":1,"j":true},"errmsg":"no such cmd: w"}

This is already strange by itself, it seems MongoDB takes "w" as the
command instead of "getLastError".

But the thrown exception comes from the call to
MongoErrorDescription(), where one of the fields read using
get!int() is missing. When I replace them by opt!int(0), no
exception is thrown, though the problem with MongoDB is of course
still there.

So I guess there are two bugs...

I should add that this happens with vibe.d from Git and MongoDB 2.4.13.