I am trying to push data to a firestore DB using PHP and the Google apis.
Inside the documentation and examples I have seen around the web, I am able to use mapValue
and arrayValue
when sending data.
The example I am using is as follows:-
[
"orderName" => ["stringValue" => "Gbeila Aliu Wahab"],
"orderLocationName" => ["stringValue" => "Accra Mall Limited"],
"orderTotalAmount" => ["doubleValue" => 150.5],
"orderDescription" => ["stringValue" => "Lorem Ipsum is simply dummy text of the printing and typesetting industry"],
"orderLocationGeoPoints" => ["geoPointValue" => (object)["latitude" => 5.5557, "longitude" => -0.1963]],
"orderStatus" => ["stringValue" => "NotAssigned"],
]
This works perfectly fine, but when I attempt to send an object or an array I get the following error returned to me:-
"message": "Invalid JSON payload received. Unknown name \"map_value\" at 'document.fields[0].value': Proto field is not repeating, cannot start list.",
when attempting to map the value using the following code:-
"orderName" => ["mapValue" => ["Gbeila Aliu Wahab", 123]]
// or
"orderName" => ["arrayValue" => ["first" => ["stringValue" => "test"], "second" => ["stringValue" => "test123"]]]
I have tried many variations to try to get this to work.
How am I supposed to be using the mapValue
and arrayValue
I can see a lot of mentions regarding the value option but I cannot see any examples on how to use the.
Any help would be greatly appreciated.
from Firebase PHP Data Submission - arrayValue, mapValue
No comments:
Post a Comment