node(id: ID!): Node
All Reindex types that implement the Node
interface have an id
that is
globally unique among all types. By using this fact, it’s possible to retrieve
any node by its id. node
root field does exactly that - returns any object
that has the Node
interface.
This root field is used by Relay to update its client-side cache.
Note that Node
only has one field - id
. If you want to retrieve fields of
concrete type, you need to use typed fragment.
query NodeExample {
node(id: "some-id") {
id,
... on Todo {
text,
completed,
}
}
}
xByField(fieldName: fieldType!): X
# For example
todoById(id: ID!): Todo
reindexTypeByName(name: String!): ReindexType
Get an object by one of it’s unique fields. id
is always unique, so all types
get XById
.
viewer: ReindexViewer
type ReindexViewer implements Node {
id: ID!
user: User
# connections to all types
allXs(first: Int = 10, last: Int, before: Cursor, after: Cursor, orderBy: _XOrdering): _XConnection
# for example
allTodos(first: Int = 10, last: Int, before: Cursor, after: Cursor, orderBy: _TodoOrdering): _TodoConnection
}
viewer
is a root field that returns ReindexViewer
. viewer
is a
Relay pattern and it holds information about current user and connections to all
the nodes of each node type. In many applications, most queries will start with
viewer
.
ReindexViewer
is a global Node
used to query all nodes and the current user.
ReindexViewer
has a user
field, which is the currently logged-in user.
If there is no logged-in user, this field will return null
.
For each node type, ReindexViewer
has a connection field with all nodes
of that type. The field is named is allObjects
where Objects
is the pluralized name of the type.