Just a quick note: The metadata value is a JSON object. So it is up to you what you store in there. If you store a string you retrieve a string, if you store a number you retrieve a number.
Could you send us your target collection id or your target id?
Did you check/log the result of your variable 'response' - that might help?
Beufort Victor