Skip to content

Commit 75caea1

Browse files
BenWhiteheadlesv
authored andcommitted
firestore: migrate usage of getCollections to listCollections (GoogleCloudPlatform#1755)
1 parent 812a020 commit 75caea1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

firestore/src/main/java/com/example/firestore/snippets/RetrieveDataSnippets.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ public List<QueryDocumentSnapshot> getAllDocuments() throws Exception {
150150
*
151151
* @return iterable of collection references.
152152
*/
153-
public Iterable<CollectionReference> getCollections() throws Exception {
153+
public Iterable<CollectionReference> listCollections() throws Exception {
154154
// [START fs_get_collections]
155155
Iterable<CollectionReference> collections =
156-
db.collection("cities").document("SF").getCollections();
156+
db.collection("cities").document("SF").listCollections();
157157

158158
for (CollectionReference collRef : collections) {
159159
System.out.println("Found subcollection with id: " + collRef.getId());

firestore/src/test/java/com/example/firestore/snippets/RetrieveDataSnippetsIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void testGetSubcollections() throws Exception {
103103
db.document("cities/SF/landmarks/example").set(data).get();
104104

105105
Iterable<CollectionReference> collections =
106-
retrieveDataSnippets.getCollections();
106+
retrieveDataSnippets.listCollections();
107107

108108
List<CollectionReference> collectionList = new ArrayList<>();
109109
for (CollectionReference collRef : collections) {

0 commit comments

Comments
 (0)