# Collections

Anytime your results return multiple values then an instance of `Collection` is returned. This allows you to iterate over your values and has a lot of shorthand methods.

When using collections as a query result you can iterate over it as if the collection with a normal list:

```python
users = User.get() #== <masoniteorm.collections.Collection>
users.count() #== 50
users.pluck('email') #== <masoniteorm.collections.Collection> of emails

for user in users:
  user.email #== 'joe@masoniteproject.com'
```

## Available Methods

|           |           |           |
| --------- | --------- | --------- |
| all       | avg       | chunk     |
| collapse  | contains  | count     |
| diff      | each      | every     |
| filter    | first     | flatten   |
| for\_page | forget    | get       |
| group\_by | implode   | is\_empty |
| last      | map\_into | map       |
| max       | merge     | pluck     |
| pop       | prepend   | pull      |
| push      | put       | reduce    |
| reject    | reverse   | serialize |
| shift     | sort      | sum       |
| take      | to\_json  | transform |
| unique    | where     | zip       |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://orm.masoniteproject.com/0.9/collections.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
