PDF (US Ltr)
- 2.4Mb
PDF (A4)
- 2.4Mb
HTML Download (TGZ)
- 251.5Kb
HTML Download (Zip)
- 258.9Kb
Copyright 1997-2021 the PHP Documentation Group.
CollectionFind::having
Set condition for aggregate functions
Description
public mysql_xdevapi\CollectionFind mysql_xdevapi\CollectionFind::having(string sort_expr);
This function can be used after the 'field' operation in order to make a selection on the documents to extract.
Parameters
-
sort_expr
This must be a valid SQL expression, the use of aggreate functions is allowed
Return Values
CollectionFind object that can be used for further processing
Examples
Example 5.34 mysql_xdevapi\CollectionFind::having
example
<?php
//Assuming $coll is a valid Collection object
//Find all the documents for which the 'age' is greather than 40,
//Only the columns 'name' and 'age' are returned in the Result object
$res = $coll->find()->fields(['name','age'])->having('age > 40')->execute();
?>