One to Many Moralis objects

I can’t figure out how to save my child obj to parent.
I have Parent obj, Parent has many child.
I checked a lot of examples, I used EF core in.net before, So I thought it’s something similar.
How can I insert a child object into a Parent? Can anyone share react code with me?
For example, Parent has objectId, TokenList what is relational to child.
Child has TokenId, Description.

You can find an example here https://v1docs.moralis.io/moralis-dapp/database/objects#many-to-many-relationships

You can use relation in that case and using relation.add() to add more children to the parent relation

Sorry, I didn’t get how it should work.
So does it mean if my Parent has a pointer to _User. Parent has relation to Children.
code would look like
const user = Moralis.User.current();
const relation = user.relation(“Parent”);
relation.add(children)
user.save();
???
Only one example in the documentation, it’s hard for me to figure out…

Where children here is an Object ( ParseObject )

Sorry I can’t understand you.If my example above is right , I’m totally confused.
If I have objectId of Parent, Why do I need to query user?
Can I add Children to parent only based on objectId of Parent?

For example, I used UI dashboard to achieve that without code.
I created 2 childs , and I can’t attach them to Parent

For that forEach error, hard refreshing the page should work.

Can I schedule a call with someone from the Moralis team, to show and receive any help for my products, Cuz I used your solution and I’ve thoughts that development would be faster, but it doesn’t look like so ,for now.

I won’t give up. I’ll place my solution here when it succeeds

About UI dashboard, bug exists. If I go to the relation row via a dashboard, I can’t see any records. When I refreshed the page, records appears. Where I can report the bug?

Hey mate, okay I got it. I successfully created child in parent.
I don’t need user. Actually I can query all relations by entity which has relation type.
Would be cool to see more examples in docs, cuz it’s rly simple but I’ve spent 2 days for it.
Can I query all child data that are link to Parent?

Or do I need to select all childs which have Parents equal to objId?

You can query Parent, get the child relation, and .query on the realtion should return the children

Can you, please, provide an example?

For example you have a post with a comment realtion holding many comments, you can get the comment from the relation in such way.

const Post = Moralis.Object.extend("Post");
const postQuery = new Moralis.Query(Post);
let post = await postQuery.first()  // Get first Post

// Comment Relation on Post
const commentRelation = post.relation("comment")
const commentsQuery = commentRelation.query()
const commentsInRelation = await commentsQuery.find()
2 Likes