The result is: {"gameData":{"gold":{"$numberLong":"0"}}}
I wanted to know if it was possible to have only the value of “gold” as a result, or a normal JSON without the “$numberLong” key (I’m not sure but I think the current result is in BSON format, but I couldn’t find a function to convert it to JSON).
You can. The default numeric data type for MongoDB is a double. If you dont use any type it will be a double. So, convert the long to a double and you get the result in the desired format.
I assume that since we chatted about MongoDB realm this is a return of a document from a webhook in EJSON format which is what could be expected when just returning it.
However, you could set the response body with the query result parsed to JSON: