---
title: .countPercent()
slug: countpercent
docTags: 
createdAt: 2021-09-14T18:35:54.000Z
---

Returns the percentage of items in a [Sequence](docId\:JG4itlQWafzLpArttFo67) or [List](docId\:xWH_cUkHj9waqaEfb7H71) that match a criteria.

The result is always returned as a [Percent](docId\:FbN7bFaHlFPV4f1C53DxA), calculated as (number of items that match the criteria) divided by (total number of items).

### Syntax

`.count{expression}`

- Returns the percentage of items in the Sequence or List where the `expression `evaluates to a truthy value

### Examples

- `[1, 2, 3, 4].countPercent{it >= 3}` returns `50%`
- `db.job.find().countPercent{dept:engineering}` returns the percentage of all jobs in the organization that are in the Engineering department.
- `db.job.find{dept:engineering gender:*}.countPercent{gender:female}` returns the percentage of Female-identified people, taken as a percentage of people in the Engineering department who have specified their gender.

