Skip to content

Commit

Permalink
Fix field order for MongoDB getLastError command.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed May 21, 2015
1 parent b6a8758 commit 9294786
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/vibe/db/mongo/connection.d
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ final class MongoConnection {
// is implemented here to allow to check errors upon every request
// on conncetion level.

Bson[string] command_and_options = [ "getLastError": Bson(1.0) ];
Bson command_and_options = Bson.emptyObject;
command_and_options["getLastError"] = Bson(1.0);

if(m_settings.w != m_settings.w.init)
command_and_options["w"] = m_settings.w; // Already a Bson struct
Expand All @@ -245,7 +246,7 @@ final class MongoConnection {
_MongoErrorDescription ret;

query!Bson(db ~ ".$cmd", QueryFlags.NoCursorTimeout | m_settings.defQueryFlags,
0, -1, serializeToBson(command_and_options), Bson(null),
0, -1, command_and_options, Bson(null),
(cursor, flags, first_doc, num_docs) {
logTrace("getLastEror(%s) flags: %s, cursor: %s, documents: %s", db, flags, cursor, num_docs);
enforce(!(flags & ReplyFlags.QueryFailure),
Expand Down

0 comments on commit 9294786

Please sign in to comment.