---
title: .ref
description: "--- ###### Specifies and Object Reference When a type references another type, it is not possible to directly query that object. The `.ref` operator enables support for such an operation. It is similar to a JOIN operation in SQL. This…"
url: "https://namazustudios.com/docs/namazu-elements-core/advanced-operators/ref/"
updated: "2026-08-13"
category: Namazu Elements Core Features / Advanced Operators
---

# .ref

---

###### Specifies and Object Reference

When a type references another type, it is not possible to directly query that object. The `.ref` operator enables support for such an operation. It is similar to a JOIN operation in SQL. This is used to reference other types which have their own `id` field and are first-class database objects.

## Example: [User](https://namazustudios.com/glossary/user/) and [Profile](https://namazustudios.com/glossary/profile/)

Given the following example of a [User](https://namazustudios.com/glossary/user/) and a [Profile](https://namazustudios.com/glossary/profile/):

The [User](https://namazustudios.com/glossary/user/) object has fields such as [name](https://namazustudios.com/glossary/name/), and [id](https://namazustudios.com/glossary/id/).

```
{
  "id" : "abcd",
  "name" : "earl1",
  "email" : "earl1@example.com"
}
```

```
{
  "id" : "defg",
  "displayName" : "Earl 1",
  "user" : {
    "id" : "abcd",
    "name" : "earl1",
    "email" : "earl1@example.com"
  }
  "application" : {
    "id" : "hijk",
    "name" : "EXAMPLE"
  }
}
```

It would, at a glance, make sense to attempt to query a [Profile](https://namazustudios.com/glossary/profile/) this way:

`User.id:abcd`

However, as [User](https://namazustudios.com/glossary/user/) is a reference that will return no results. Therefore it is necessary to use the reference operator to perform the query:

`.ref.User:abcd`

This tells the query engine to execute the following:

- Identify the client is requesting a reference to another object.
- Identify the reference as the `User` field.
- Find a [User](https://namazustudios.com/glossary/user/) with `id = "abcd"`
- Find all Profiles matching that [User](https://namazustudios.com/glossary/user/).
