Create a Firestore document reference from a document path

Create a Firestore document reference from a document path

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample

Go

alovelaceRef := client.Doc("users/alovelace")

Java

// Reference to a document with id "alovelace" in the collection "users"
DocumentReference document = db.document("users/alovelace");

Node.js

const alovelaceDocumentRef = db.doc('users/alovelace');

PHP

$document = $db->document('users/lovelace');

Python

a_lovelace_ref = db.document(u'users/alovelace')

Ruby

document_path_ref = firestore.doc "users/alovelace"

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.