我想将具有引用字段类型的数据添加到我的集合中。如何在PHP中编写代码?
我添加了:
$db = new FirestoreClient([
'projectId' => $projectId,
]);
$addedDocRef = $db->collection('locations')->newDocument();
$addedDocRef->set([
'decisionRef' => $db->document('decisions/' . $ID),
'formattedAddress' => $formattedAddress,
'point' => [
'geohash' => $geohash,
'geopoint' => new GeoPoint($lat,$lng)
]
]);
我希望在文档中看到一个引用类型字段,但出现此错误:
未捕获的Google \ ApiCore \ ValidationException:呈现'projects / {project = } / databases / {database = }'时出错:预期的绑定...
答案 0 :(得分:0)
解决方案是在set([...])数组外设置$ decisionRef
var area = d3
.area()
.x(function(d) {
return xScale(d.startTime);
})
.y0(function(d) {
return yScale(d.magnitude);
})
.y1(yScale(0));