public Iterable < CollectionReference > listCollections ( ) { ListCollectionIdsRequest . Builder request = ListCollectionIdsRequest . newBuilder ( ) ; request . setParent ( path . toString ( ) ) ; final ListCollectionIdsPagedResponse response ; try { response = ApiExceptions . callAndTranslateApiException ( firestore . sendRequest ( request . build ( ) , firestore . getClient ( ) . listCollectionIdsPagedCallable ( ) ) ) ; } catch ( ApiException exception ) { throw FirestoreException . apiException ( exception ) ; } return new Iterable < CollectionReference > ( ) { @ Override @ Nonnull public Iterator < CollectionReference > iterator ( ) { final Iterator < String > iterator = response . iterateAll ( ) . iterator ( ) ; return new Iterator < CollectionReference > ( ) { @ Override public boolean hasNext ( ) { return iterator . hasNext ( ) ; } @ Override public CollectionReference next ( ) { return DocumentReference . this . collection ( iterator . next ( ) ) ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( "remove" ) ; } } ; } } ; }
Fetches the subcollections that are direct children of this document .