@ Nonnull public ApiFuture < DocumentReference > add ( @ Nonnull final Map < String , Object > fields ) { final DocumentReference documentReference = document ( ) ; ApiFuture < WriteResult > createFuture = documentReference . create ( fields ) ; return ApiFutures . transform ( createFuture , new ApiFunction < WriteResult , DocumentReference > ( ) { @ Override public DocumentReference apply ( WriteResult writeResult ) { return documentReference ; } } ) ; }
Adds a new document to this collection with the specified data assigning it a document ID automatically .