# Variables

{% hint style="info" %}
Aggregation expressions can use both user-defined and system variables.

Variables can hold any BSON type data. To access the value of the variable, prefix the variable name with double dollar signs ($$); i.e. "$$".
{% endhint %}

For example:

| Variable | Access via $ | Brief Description                                                               |
| -------- | ------------ | ------------------------------------------------------------------------------- |
| close    | `$$CLOSE`    | returns the absolute value of a number                                          |
| context  | `$$CONTEXT`  | returns a numeric value between 0 and π radians for x between -1 and 1          |
| cursor   | `$$CURSOR`   | returns the inverse hyperbolic cosine of a number                               |
| date     | `$$DATE`     | N/A                                                                             |
| env      | `$$ENV`      | N/A                                                                             |
| now      | `$$NOW`      | A variable that returns the current datetime value                              |
| random   | `$$RANDOM`   | returns a floating-point, pseudo-random number in the range 0 to less than 1    |
| remove   | `$$REMOVE`   | A variable which evaluates to the missing value                                 |
| request  | `$$REQUEST`  | N/A                                                                             |
| root     | `$$ROOT`     | References the root currently being processed in the aggregation pipeline stage |
| script   | `$$SCRIPT`   | N/A                                                                             |
| var      | `$$VAR`      | N/A                                                                             |


---

# 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://docs.medable.com/cortex-api/expressions/variables.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.
