private static boolean isValueAValidGeoQuery ( final Object value ) { if ( value instanceof DBObject ) { String key = ( ( DBObject ) value ) . keySet ( ) . iterator ( ) . next ( ) ; return key . equals ( "$box" ) || key . equals ( "$center" ) || key . equals ( "$centerSphere" ) || key . equals ( "$polygon" ) ; } return false ; }
this could be a lot more rigorous