File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -560,6 +560,17 @@ function getAll(db) {
560
560
return allCities ;
561
561
}
562
562
563
+ function getCollections ( db ) {
564
+ // [START get_collections]
565
+ var sfRef = db . collection ( 'cities' ) . doc ( 'SF' ) ;
566
+ sfRef . getCollections ( ) . then ( collections => {
567
+ collections . forEach ( colleciton => {
568
+ console . log ( 'Found subcollection with id:' , collection . id ) ;
569
+ } ) ;
570
+ } ) ;
571
+ // [END get_collections]
572
+ }
573
+
563
574
// ============================================================================
564
575
// https://firebase.google.com/docs/firestore/server/query-data
565
576
// ============================================================================
@@ -922,6 +933,10 @@ describe("Firestore Smoketests", () => {
922
933
return getAll ( db )
923
934
} ) ;
924
935
936
+ it ( "should get all subcollections of a document" , ( ) => {
937
+ return getCollections ( db ) ;
938
+ } ) ;
939
+
925
940
it ( "should query and filter" , ( ) => {
926
941
return queryAndFilter ( db )
927
942
} ) ;
You can’t perform that action at this time.
0 commit comments