0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

errorHandling for median key

This commit is contained in:
Eliot Horowitz 2009-03-30 17:12:50 -04:00
parent 7109189774
commit d1427f7232

View File

@ -811,13 +811,18 @@ namespace mongo {
BSONObj max = jsobj.getObjectField( "max" ); BSONObj max = jsobj.getObjectField( "max" );
if ( ns[ 0 ] == '\0' || min.isEmpty() || max.isEmpty() ) { if ( ns[ 0 ] == '\0' || min.isEmpty() || max.isEmpty() ) {
errmsg = "invalid command syntax"; errmsg = "invalid command syntax (note: min and max are required)";
return false; return false;
} }
setClient( ns ); setClient( ns );
const IndexDetails *id = 0; const IndexDetails *id = 0;
NamespaceDetails *d = nsdetails( ns ); NamespaceDetails *d = nsdetails( ns );
if ( ! d ){
errmsg = "ns not found";
return false;
}
BSONObj keyPattern = jsobj.getObjectField( "keyPattern" ); BSONObj keyPattern = jsobj.getObjectField( "keyPattern" );
if ( keyPattern.isEmpty() ) { if ( keyPattern.isEmpty() ) {
BSONObjIterator i( min ); BSONObjIterator i( min );