Create a Firestore collection reference

Create a Firestore collection reference

Documentation pages that include this code sample

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

Code sample

Go

usersRef := client.Collection("users")

Java

// Reference to the collection "users"
CollectionReference collection = db.collection("users");

Node.js

const usersCollectionRef = db.collection('users');

PHP

$collection = $db->collection('samples/php/users');

Python

users_ref = db.collection(u'users')

Ruby

collection_ref = firestore.col "users"

What's next

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