I'm not sure they are comparable, both Russia and the US lost relatively few soldiers in Afganistan, as there were no outright battles just a series of skirmishes, both didn't leave because they got a kicking more the realization that the costs of staying there were too high versus what they eventually realised was no return/benefit.
And remember they were both there for a good many years, before they became bored, you would hope this current war doesn't drag on that long but all the signs are it will unless one side gets a decisive advantage. Currently Russia seems to be gaining a slight upper hand but all that really depends on the response of the west.