content_image/682256.jpg content_image/682255.jpg
## Additional Resources 

• MongoDB and MySQL Compared 22 

• Quick Reference Cards 23 

• MongoDB Database Modernization Consulting Package 24 

## 7.4.4 Aggregation Commands 

## Aggregation Commands 

<img src='content_image/682256.jpg'>

## Aggregation Methods 

<img src='content_image/682255.jpg'>

## 7.4.5 Variables in Aggregation Expressions 

Aggregation expressions (page 470) can use both user-defined and system variables. 

Variables can hold any BSON type data (page 178). To access the value of the variable, use a string with the variable name prefixed with double dollar signs ( $$ ). 

If the variable references an object, to access a specific field in the object, use the dot notation; i.e. "$$<variable>.<field>" . 

## User Variables 

User variable names can contain the ascii characters [_a-zA-Z0-9] and any non-ascii character. 

User variable names must begin with a lowercase ascii letter [a-z] or a non-ascii character. 

## System Variables 

MongoDB offers the following system variables: 

