(#3042) - fix upsert function in guide

The mistake was made because I copy-pasted from our own code without checking it.

I ran this code and verified it works. Should probably be turned into a live example, though.