From dc9de883bef0fcf90ce03a0d3f45d30e22d9be7b Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 19 Jul 2010 10:57:16 -0400 Subject: [PATCH] passthrough mongod $err through mognos SERVER-1431 --- client/parallel.cpp | 7 +++++++ jstests/sharding/auto2.js | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/client/parallel.cpp b/client/parallel.cpp index 2fcc2d96a22..7a1d88d7e07 100644 --- a/client/parallel.cpp +++ b/client/parallel.cpp @@ -72,6 +72,13 @@ namespace mongo { throw StaleConfigException( _ns , "ClusteredCursor::query" ); } + if ( cursor->hasResultFlag( ResultFlag_ErrSet ) ){ + conn.done(); + BSONObj o = cursor->next(); + throw UserException( o["code"].numberInt() , o["$err"].String() ); + } + + cursor->attach( &conn ); conn.done(); diff --git a/jstests/sharding/auto2.js b/jstests/sharding/auto2.js index bb2ffb9c213..952792e746e 100644 --- a/jstests/sharding/auto2.js +++ b/jstests/sharding/auto2.js @@ -127,4 +127,8 @@ for ( i=0; i<20; i++ ){ print( "checkpoint G") +assert.throws( function(){ s.getDB( "test" ).foo.find().sort( { s : 1 } ).forEach( printjsononeline ) } ) + +print( "checkpoint H") + s.stop();