Permalink
Browse files

Safer filemd5 command

  • Loading branch information...
1 parent 7f03ac9 commit 3e47000a1a85527334fb6150403df82d0e6066f4 @RedBeard0531 RedBeard0531 committed Apr 29, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 db/dbcommands.cpp
View
@@ -889,8 +889,10 @@ namespace mongo {
auto_ptr<DBClientCursor> cursor = db.query( ns.c_str() , q );
int n = 0;
while ( cursor->more() ){
- BSONObj c = cursor->next();
- int myn = c.getIntField( "n" );
+ BSONObj c = cursor->nextSafe();
+ BSONElement ne = c["n"];
+ assert(ne.isNumber());
+ int myn = ne.numberInt();
if ( n != myn ){
log() << "should have chunk: " << n << " have:" << myn << endl;
uassert( 10040 , "chunks out of order" , n == myn );

0 comments on commit 3e47000

Please sign in to comment.