I have MongoDB collection of documents containing several fields. One of the columns/fields should be numeric only, but some of these fields contain non-numerical (corrupt)
You can use aggregate function to get maximum number from collections like this.
$data=$collection->aggregate(array ( '$group'=> array('_id'=>'', 'age'=>array('$max'=>'$age'.) ) ) );