Limits the number of documents passed to the next stage in the pipeline.

@see http://docs.mongodb.org/manual/reference/operator/aggregation/limit/
165458
public function limit(int $limit) : Stage\Limit
    {
        $stage = new Stage\Limit($this, $limit);
        $this->addStage($stage);

        return $stage;
    }
446728
private void sieveSingle(int limit, int start, int step) {
        while(start < limit) {
            set(start);
            start += step;
        }
    }
1302540
function (next) {
            // if no documents to index, skip population
            if (!docsToIndex) {
                return next()
            }

            // stream docs - and upload in batches of size BATCH_SIZE
            var docStream = self.find().stream()

            // elasticsearch commands to perform batch-indexing
            var commandSequence = [];

            docStream.on('data', function (doc) {
                if (!doc || !doc._id) {
                    excludedDocs++;
                    return
                }

                // get rid of mongoose-added functions
                doc = helpers.serializeModel(doc,options)

                var selfStream = this
                var strObjectId = doc._id

                var command = {
                    index: {
                        _index: versionedIndexName,
                        _type: options.type,
                        _id: strObjectId
                    }
                }

                // append elasticsearch command and JSON-ified doc to command
                commandSequence.push(command)
                commandSequence.push(doc)


                if (commandSequence.length === BATCH_SIZE) {
                    // pause the stream of incoming docs until we're done
                    // indexing the batch in elasticsearch
                    selfStream.pause()

                    exports.bulkIndexRequest(versionedIndexName, commandSequence, options, function (err) {
                        if (err) {
                            return next(err)
                        }

                        // empty our commandSequence
                        commandSequence = []

                        // keep streaming now that we're ready to accept more
                        selfStream.resume()
                    })
                }
            })

            docStream.on('close', function () {
                // if no documents left in buffer, don't perform a bulk index request
                if (!commandSequence.length) {
                    return next()
                }

                // take care of the rest of the docs left in the buffer
                exports.bulkIndexRequest(versionedIndexName, commandSequence, options, function (err) {
                    if (err) {
                        return next(err)
                    }

                    // empty the commandSequence
                    commandSequence = []

                    return next()
                })
            })
        }
418340
public function limitExceeded()
    {
        $limit = $this->_agent->getLimit();
        return $limit != CollectionAgentAbstract::NO_LIMIT && $this->_count > $this->_agent->getLimit();
    }
431804
public function limit($num)
    {
        $num = (integer) $num;
        $this->limit = $num;
        $this->mongoCursor->limit($num);
        return $this;
    }
1059292
def get_more
      with_retry(session.cluster) do
        reply = @node.get_more @database, @collection, @cursor_id, request_limit
        @limit -= reply.count if limited?
        @cursor_id = reply.cursor_id
        reply.documents
      end
    end
320881
def limit(self, limit):
        

        if not isinstance(limit, int) or isinstance(limit, bool):
            raise InvalidUsage("limit size must be of type integer")

        self._sysparms['sysparm_limit'] = limit
488111
def limit(self, limit):
    
    params = join_params(self.parameters, {"limit": limit})

    return self.__class__(**params)
367688
private void applyVerticalLimit()
    {
        if (mover.getY() < limitBottom && limitBottom != Integer.MIN_VALUE)
        {
            mover.teleportY(limitBottom);
        }
        else if (mover.getY() > limitTop && limitTop != Integer.MAX_VALUE)
        {
            mover.teleportY(limitTop);
        }
    }
349508
function createQueryWithLimit() {
            // We query only limit number in case of big table
            // If we query with more than million data query will hang up
            const query = _this.initQuery(namespace);
            if (ancestors) {
                query.hasAncestor(_this.gstore.ds.key(ancestors.slice()));
            }
            query.select('__key__');
            query.limit(limitDataPerQuery);

            return query;
        }
205549
protected function storeOriginalLimit()
    {
        if (isset($this->params[1]['limit'])) {
            $this->originalLimit = $this->params[1]['limit'];
        }

        if ($this->originalLimit > self::DOCUMENT_LIMIT) {
            $this->limit(self::DOCUMENT_LIMIT);
        }
    }
1134141
def init_limit(self, key, lower=None, upper=None, limit=False):
        
        above = agtb(self.__dict__[key], upper)
        for idx, item in enumerate(above):
            if item == 0.:
                continue
            maxval = upper[idx]
            self.log(
                '{0} <{1}.{2}> above its maximum of {3}.'.format(
                    self.name[idx], self._name, key, maxval), ERROR)
            if limit:
                self.__dict__[key][idx] = maxval

        below = altb(self.__dict__[key], lower)
        for idx, item in enumerate(below):
            if item == 0.:
                continue
            minval = lower[idx]
            self.log(
                '{0} <{1}.{2}> below its minimum of {3}.'.format(
                    self.name[idx], self._name, key, minval), ERROR)
            if limit:
                self.__dict__[key][idx] = minval
160534
public function setLimit($limit) {
        if(is_numeric($limit))
            $this->items_per_page = $limit;
        $this->setCurrent( self::findCurrentPage($this->routeKey));
    }
1131750
def __buildLimit(self, query ,limitResMax):
        """"""
        limit = query._getParameters()['limit']
        if limitResMax>0 and limitResMax < limit:
            query = UpdateParameter(query, 'limit', limitResMax)
            query = UpdateParameter(query, 'nocount', 'true')        
        elif  limitResMax>0 and  limitResMax >= limit:
            query = UpdateParameter(query, 'nocount', 'true')
        return query
7418
public Mappings limit(int limit) {
        return new Mappings(query, target, Iterables.limit(iterable, limit));
    }
1361774
public function exceedsLimit()
    {
        if ($this->limit === null) {
            return false;
        }

        return $this->relatedValues->count() >= $this->limit;
    }
1073819
public void setLimits(java.util.Collection<Limit> limits) {
        if (limits == null) {
            this.limits = null;
            return;
        }

        this.limits = new java.util.ArrayList<Limit>(limits);
    }