What is the purpose of msg in Delete Payload?

In the GraphQL generated schema the Delete[Type]Payload contains a msg field. This message field in the source will only ever be “Deleted” or “No nodes were deleted” and is conditionally based upon the numUids from the mutation.

No other mutation payload returns any such similar msg such as “Added”/“Updated” or “No nodes were added”/“No nodes were updated”. I just don’t see the purpose in keeping this msg field around. If needed I can generate my own msg based upon the numUids response.


This would be helpful if this message returned back other messages such as, “You do not have access to add/update/delete” after evaluating the auth rules. If this is the case though, then this msg field should be added to all of the mutation payloads.

After you delete the numUids will be 0, right? So the extra message will be required to tell you if your delete was successful.

Looking at this code, the numUids return the number of ids deleted and if it is 0 (:365) then the msg is changed to “No nodes were deleted”

I’m quite sure that that function was added because extractMutation() of a delete would be 0. And if my understanding of the codebase is solid (and it’s not), schema.NumUid is the number of UIDs that match the filter.

I’m gunna say ‘historical’ for msg. In the original version (way back), it was the only field. The goal at that point was to build towards what we have now with the payload with the object result type (even the numUids might not be needed if we had aggregations in there).

In general numUids == length of results array. But you can of course filter that array, so sometimes it’s helpful to have both. I think the “Deleted” or not is as per @amaster507 suggested and is just the number of things that got mutated, e.g

There is are subtleties here cause the number of things that can be returned might be different to the total number of things matched in the filter or mutated cause of auth (e.g. if the delete and query rules don’t equal the same things).

I don’t see a problem with removing it … but there could be cases where you want to return some more info in all the payloads of all the mutations.

2 Likes