Carrot reference
Methods
.count()
.count()
- Returns the total number of items in the Sequence or List
.count{expression}
- Returns the number of items in the Sequence or List where the expression evaluates to a truthy value
- [1, 2, 3].count() returns 3
- [1, 2, 3].count{it >= 2} returns 2
- db.job.find{dept:engineering}.count() returns the number of jobs in the Engineering department.
- db.job.find{dept:engineering}.count{baseComp > 100000} returns the number of jobs in the Engineering department where base compensation is at least $100k.