getAllOfNodeType
A function to get a all nodes of a certain node type.
Parameters:
nodeType
: string, the node type you wish to fetchoptions
(optional): {limit
(optional): number, the limit of # of nodes you wish to fetchpage
(optional): number, the page of nodes you wish to fetchorderBy
(optional): "updatedAt" | "createdAt", which of those to order the result byorderDirection
(optional): "ASC" | "DESC", whether to order the nodes ascending or descending per theorderBy
prop
}
Output:
data
: the data from the node you wish to fetch consistent with the NodeType's stateSchema, null if errorerror
: the error that occurred, null if operation successful
Example 1
With no options passed
Code:
import { getAllOfNodeType } from "../uix/functionModule"
const fetchedNodes = await getAllOfNodeType("User")
return fetchedNodes
Output:
{
data: [{
username: "johndoe",
password: "dj32wdi2n393ndunwieudnqijwd9oasimdoajsfe",
lastLoginTime: "2024-07-05T15:20:10Z"
},
{
username: "janedoe",
password: "fdnwinedun2idmnci2mnedkqwjndkjsndksjnfks",
lastLoginTime: "2024-07-03T15:34:10Z"
}],
error: null
}
Example 2
With options passed
Code:
import { getAllOfNodeType } from "../uix/functionModule"
const fetchedNodes = await getAllOfNodeType("User", {limit: 1})
return fetchedNodes
Output:
{
data: [{
username: "johndoe",
password: "dj32wdi2n393ndunwieudnqijwd9oasimdoajsfe",
lastLoginTime: "2024-07-05T15:20:10Z"
}],
error: null
}