.name
Specifies an Object by Name
When a type references another type, it is not possible to directly query that object. The .name
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 name
field and are first-class database objects.
Example: User and Profile
Given the following example of a User and a Profile:
The User object has fields such as name, and ID.
{
"id" : "abcd",
"name" : "earl1",
"email" : "[email protected]"
}
{
"id" : "defg",
"displayName" : "Earl 1",
"user" : {
"id" : "abcd",
"name" : "earl1",
"email" : "[email protected]"
}
"application" : {
"id" : "hijk",
"name" : "EXAMPLE"
}
}
It would, at a glance, make sense to attempt to query a Profile this way:
user.name:earl1
However, as User is a reference that will return no results. Therefore it is necessary to use the reference operator to perform the query:
.name.user:earl1
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 with
name = "earl1"
Find all Profiles matching that user.