Home > Software engineering >  (limit) in mongodb aggregration
(limit) in mongodb aggregration

Time:10-13

db.collection.aggregate([{$limit :  0}])

if we are passing zero it is showing error, with alert a message provide positive value. how can I get all the documents in mongodb Aggregation by giving limit object or any different idea in mongodb aggregation.

CodePudding user response:

Limit at least 1. If you limit 0, might as well just say const foo = [].

For all documents, just do find({}). Or use aggregate without a match.

  • Related