@ Nonnull public Iterable < DocumentReference > listDocuments ( ) { ListDocumentsRequest . Builder request = ListDocumentsRequest . newBuilder ( ) ; request . setParent ( path . getParent ( ) . toString ( ) ) ; request . setCollectionId ( this . getId ( ) ) ; request . setMask ( DocumentMask . getDefaultInstance ( ) ) ; request . setShowMissing ( true ) ; final ListDocumentsPagedResponse response ; try { response = ApiExceptions . callAndTranslateApiException ( firestore . sendRequest ( request . build ( ) , firestore . getClient ( ) . listDocumentsPagedCallable ( ) ) ) ; } catch ( ApiException exception ) { throw FirestoreException . apiException ( exception ) ; } return new Iterable < DocumentReference > ( ) { @ Override @ Nonnull public Iterator < DocumentReference > iterator ( ) { final Iterator < Document > iterator = response . iterateAll ( ) . iterator ( ) ; return new Iterator < DocumentReference > ( ) { @ Override public boolean hasNext ( ) { return iterator . hasNext ( ) ; } @ Override public DocumentReference next ( ) { ResourcePath path = ResourcePath . create ( iterator . next ( ) . getName ( ) ) ; return document ( path . getId ( ) ) ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( "remove" ) ; } } ; } } ; }
Retrieves the list of documents in this collection .