jejunumJ
Convex Communityβ€’2y agoβ€’
21 replies
jejunum

Appending to Array using Mutation

A super simple question but I couldn't find too much on this, I have a data schema for a node which contains a childArray[]. What is the mutation call for appending to an array?

node: defineTable({
    // Array of childNodes
    childNodes: v.array(v.string()),
  })


For some more context, this is what I have at the moment for my array push function... (syntax is wrong!):
        const node = await ctx.db.patch(args.parentNode, {
            $push: {childNodes: args.childNode},
        });


Effectively, I need a function that appends a storageId into childNodes :3

Thanks
Was this page helpful?