Setting an attribute on a node

I’m trying to use setNodeType to set an attribute on a node, but it isn’t updating the node in the dom or doc.

  updateMediaHeight (id, height) {
    // Get PM Pos of node to change
    let index = 0
    let pos
    for (let node of {
      if ( === id) {
        pos = new Pos([index], 0)
    // Set height attr on block, GridSchema.nodeType('media'), {height}).apply()

Is something off with how I’m getting the Pos or calling setNodeType?

Would it be possible to have a more-direct method, like Transform.setNodeAttributes(node, attrs)?

I have a similar requirement for the answers to a multiple choice question. In that case, the radiobutton for each answer should have a value from 1-n. As they add/delete answers or move them around I need to renumber the answers values.

Any pointers on the simple case of changing an attribute on a node? Multiple attributes on multiple nodes?

I think the problem is that you are creating a position inside the node, whereas setNodeType wants one pointing in front of the node, so new Pos([], index).