op:limit( $plan as map:map, $length as item() ) as map:map
This method specifies the maximum number of rows to be returned by this Plan.
xquery version "1.0-ml"; import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy"; let $employees := op:from-view("main", "employees") let $expenses := op:from-view("main", "expenses") let $totalexpenses := op:col("totalexpenses") return $employees => op:join-inner($expenses, op:on( op:view-col("employees", "EmployeeID"), op:view-col("expenses", "EmployeeID"))) => op:group-by(op:view-col("employees", "EmployeeID"), ("FirstName", "LastName", op:view-col("expenses", "Category"), op:sum($totalexpenses, op:view-col("expenses", "Amount")))) => op:order-by(op:view-col("employees", "EmployeeID")) => op:limit(10) => op:result()