How can I run a dql mutation in a slash dgraph lambda? If I have something like this:
async function newPost({args, dql}) {
const newArgs = {
name: args.name,
description: args.description,
nameKebab: args.name.replace(/\s/g,"-").toLowerCase(),
published: args.published
};
const results = await dql.query(`mutation addPost($post: AddPostInput!) {
addPost(input: [$post]) {
post {
id
name
description
published
}
}
}`, {"post": newArgs});
console.log(JSON.stringify(results.data));
return results.data.addPost.post[0].id
}
I don’t believe dql.mutation works. Am I supposed to run an upsert instead of a mutation?
This posts is talking about @custom mutations, not lambdas, but I assume the premise is the same…
How do I run an upsert if that is the case dql.upsert?.. and with an upsert do I just run a blank query?
Thanks,
J