class_docstr: Aggregation request which can be passed to `Client.aggregate`.
class_docstr_tok: ["Aggregation","request","which","can","be","passed","to","`","Client.aggregate","`","."]
docstr: Sets the limit for the most recent group or query.
  
  If no group has been defined yet (via `group_by()`) then this sets
  the limit for the initial pool of results from the query. Otherwise,
  this limits the number of items operated on from the previous group.
  
  Setting a limit on the initial search results may be useful when
  attempting to execute an aggregation on a sample of a large data set.
  
  ### Parameters
  
  - **offset**: Result offset from which to begin paging
  - **num**: Number of results to return
  
  
  Example of sorting the initial results:
  
  ```
  AggregateRequest("@sale_amount:[10000, inf]")            .limit(0, 10)            .group_by("@state", r.count())
  ```
  
  Will only group by the states found in the first 10 results of the
  query `@sale_amount:[10000, inf]`. On the other hand,
  
  ```
  AggregateRequest("@sale_amount:[10000, inf]")            .limit(0, 1000)            .group_by("@state", r.count()            .limit(0, 10)
  ```
  
  Will group all the results matching the query, but only return the
  first 10 groups.
  
  If you only wish to return a *top-N* style query, consider using
  `sort_by()` instead.
docstr_tok: ["Sets","the","limit","for","the","most","recent","group","or","query",".","If","no","group","has","been","defined","yet","(","via","`","group_by","(",")","`",")","then","this","sets","the","limit","for","the","initial","pool","of","results","from","the","query",".","Otherwise",",","this","limits","the","number","of","items","operated","on","from","the","previous","group",".","Setting","a","limit","on","the","initial","search","results","may","be","useful","when","attempting","to","execute","an","aggregation","on","a","sample","of","a","large","data","set",".","#","#","#","Parameters","-","*","*","offset","*","*",":","Result","offset","from","which","to","begin","paging","-","*","*","num","*","*",":","Number","of","results","to","return","Example","of","sorting","the","initial","results",":","``","`","AggregateRequest","(","``","@","sale_amount",":","[","10000",",","inf","]","''",")",".limit","(","0",",","10",")",".group_by","(","``","@","state","''",",","r.count","(",")",")","``","`","Will","only","group","by","the","states","found","in","the","first","10","results","of","the","query","`","@","sale_amount",":","[","10000",",","inf","]","`",".","On","the","other","hand",",","``","`","AggregateRequest","(","``","@","sale_amount",":","[","10000",",","inf","]","''",")",".limit","(","0",",","1000",")",".group_by","(","``","@","state","''",",","r.count","(",")",".limit","(","0",",","10",")","``","`","Will","group","all","the","results","matching","the","query",",","but","only","return","the","first","10","groups",".","If","you","only","wish","to","return","a","*","top-N","*","style","query",",","consider","using","`","sort_by","(",")","`","instead","."]
code: def limit(self, offset: int, num: int) -> "AggregateRequest":
      """
          Sets the limit for the most recent group or query.
  
          If no group has been defined yet (via `group_by()`) then this sets
          the limit for the initial pool of results from the query. Otherwise,
          this limits the number of items operated on from the previous group.
  
          Setting a limit on the initial search results may be useful when
          attempting to execute an aggregation on a sample of a large data set.
  
          ### Parameters
  
          - **offset**: Result offset from which to begin paging
          - **num**: Number of results to return
  
  
          Example of sorting the initial results:
  
          ```
          AggregateRequest("@sale_amount:[10000, inf]")\
              .limit(0, 10)\
              .group_by("@state", r.count())
          ```
  
          Will only group by the states found in the first 10 results of the
          query `@sale_amount:[10000, inf]`. On the other hand,
  
          ```
          AggregateRequest("@sale_amount:[10000, inf]")\
              .limit(0, 1000)\
              .group_by("@state", r.count()\
              .limit(0, 10)
          ```
  
          Will group all the results matching the query, but only return the
          first 10 groups.
  
          If you only wish to return a *top-N* style query, consider using
          `sort_by()` instead.
  
          """
      _limit = Limit(offset, num)
      self._aggregateplan.extend(_limit.build_args())
      return self
  
imports: from typing import List, Union
label_desc: Use image node_id 5 for calling the AggregateRequest obj's underlying member method code with example usage: obj.limit(offset, num) and returns: self