How to get the id of newly created object from the mutation in graphql?

I would like to get the id from graphql mutation run in a lambda function or anywhere else. However, the only two available options are numUid and a payload which requires a filter. Is there a way I can simply get the id of the new object created from the mutation?

For example,

addCar(
  name: "Red car"
) {
  numUids
  id <--------- Can't seem to have an option like this where I can get the id of newly created object. Is there a way?
}

Hey @Alley_123 , Welcome to the Dgraph forums!

Would something like that work?

async function foo({ args, graphql }) {
  const results = await graphql(
    `
      mutation($blah: ....) {
        addFoo(input: [{ blahblahblah }]) {
          foo {
            id
          }
        }
      }
    `,
    { blah: ... }
  );
  return results.data.addFoo.foo[0].id;
}