Skip to main content

getChildNodeSet

A function to get the node set of a node type from a certain parent node.

(Note: by default, no node sets are defined. They must be defined at your discretion, please see Defining Node Set Relationships for more info)

Parameters:

  • nodeKey: the nodeKey ({nodeType, nodeId}) that specifies the parent who's children you wish to fetch
  • childNodeType: string, the type of the childNode you wish to fetch

Output:

  • data: the data from the child nodes you wish to fetch consistent with the NodeType's stateSchema, null if error
  • error: the error that occurred, null if operation successful

Example

(Note: for reference, the function call below is defined similar to the example here)

Code:

import { defineNodeSetRelationship } from "../uix/functionModule"

const fetchedNodes = await defineNodeSetRelationship({nodeType: "Profile", nodeId: "djwqndin23indiwenf8y2b8unediwjenf"}, "Posts")

return fetchedNodes

Output:

{
data: [{
postTitle: "Hello World",
postDescription: "I am here!",
postDate: "2024-07-05T15:20:10Z"
},
{
postTitle: "Goodbye World",
postDescription: "I am not here!",
postDate: "2024-06-05T15:20:10Z"
}],
error: null
}

(Note: node set relationships must be defined using the defineNodeSetRelationship method)