$set not working for runCommand update when trying to copy values into a new value

So I have a collection called dummyCollection where I’ve defined two string properties called username and passoword. Username is declared as string and password as binData. I want to use these two to create a new property called user which would serve as a key value map. I want to update the exisiting collections in the data base so that the current value for username and password would be used to construct this new users object. This doesn’t seem to work. Instead, the values from username and password are copied as string literal. Unfortunately, I can only do update via runCommand. Anything I’m doing wrong here?

{
    "update": "dummyCollection",
    "updates":
    [
        {
            "q":
            {
                "username":
                {
                    "$exists": true
                },
                "password":
                {
                    "$exists": true
                }
            },
            "u":
            {
                "$set":
                {
                    "users.dummyUser":
                    {
                        "username": "$username",
                        "password": "$password"
                    }
                }
            },
            "multi": true
        }
    ]
}

You need to update with aggregation. But since you

which I really do not understand why you cannot use the normal API, you gonna have to find how to map the update with aggregation to its matching runCommand. It is probably documented somewhere.