Closed waqarfazal closed 3 years ago
Found the solution I just gave the $collection
parameter like "collection_name/document_id" & it worked. Thank you
Here is the working code
$collection = "categories/".(string) $id; $firestoreClient->setDocument($collection, [ 'name' => $request->name, 'description' => $request->description, 'picture' => $filename, ], [ 'exists' => true, // Indicate document must exist ] );
Solution found
Hi! i'm trying to update the document using
$firestoreClient->setDocument()
. But it's giving me an error "The path you have defined is invalid. Path: categories". Please help me what i'm missing. Thank you Here is my code$collection = "categories"; $documentId = $id; $firestoreClient->setDocument($collection, $documentId, [ 'name' => $request->name, 'description' => $request->description, 'picture' => $filename, ], [ 'exists' => true, // Indicate document must exist ] );