Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
文档父名称在Firestore PHP SDK的索引53处缺少集合id_Php_Firebase_Google Cloud Firestore - Fatal编程技术网

文档父名称在Firestore PHP SDK的索引53处缺少集合id

文档父名称在Firestore PHP SDK的索引53处缺少集合id,php,firebase,google-cloud-firestore,Php,Firebase,Google Cloud Firestore,我试图在Google Firestore中查询子集合。我的目标是在1970年1月1日之后使用startDate(存储在Google Firestore的时间戳数据类型中)获取所有记录 我正在使用GoogleCloud Firestore PHP SDK来实现这一点: 这是我的密码: $config = array( "projectId" => "xxx-test", "keyFile" => json_decode(file_get_con

我试图在Google Firestore中查询子集合。我的目标是在1970年1月1日之后使用startDate(存储在Google Firestore的时间戳数据类型中)获取所有记录

我正在使用GoogleCloud Firestore PHP SDK来实现这一点:

这是我的密码:

    $config = array(
        "projectId" => "xxx-test",
        "keyFile" => json_decode(file_get_contents("/xxx/firebase_auth.json"), true)
    );
    $firestore = new FirestoreClient($config);
    $collection = $firestore->collection("/clients/-LXXXXXX/trips");
    $query = $collection->where("startDate", ">=", new Timestamp(new \DateTime("Thu Jan 1st 1970")));
    var_dump($query->documents());
我得到了这个错误:

    Exception 'Google\Cloud\Core\Exception\BadRequestException' with message 
    '{
        "message": "Document parent name \"projects\/xxx-test\/databases\/(default)\/documents\/\/clients\/-LXXXXXX\" lacks a collection id at index 53.",
        "code": 3,
        "status": "INVALID_ARGUMENT",
        "details": []
    }'

非常感谢您的帮助。

收集路径不是这样工作的:

$collection = $firestore->collection("clients")->document("-LXXXXXX")->collection("trips");

集合路径不是这样工作的:

$collection = $firestore->collection("clients")->document("-LXXXXXX")->collection("trips");