Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/firestore/collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ For example, a user updates the third item in a list. In a state based method li

## Adding documents to a collection

To add a new document to a collection with a generated id use the `add()` method. This method uses the type provided by the generic class to validate it's type structure.
To add a new document to a collection with a generated id use the `add()` method. This method uses the type provided by the generic class to validate it's type structure. This method returns an `AngularFirestoreDocument`, which provides methods for streaming, updating, and deleting. [See Using Documents with AngularFirestore for more information on how to use documents](documents.md).

#### Basic example

Expand Down
8 changes: 4 additions & 4 deletions src/firestore/collection/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export class AngularFirestoreCollection<T=DocumentData> {
}

/**
* Retrieve the results of the query once.
* @param options
* Retrieve the results of the query once.
* @param options
*/
get(options?: firestore.GetOptions) {
return from(this.query.get(options)).pipe(
Expand All @@ -130,8 +130,8 @@ export class AngularFirestoreCollection<T=DocumentData> {
* when you update data it is not updating data to the window of your query unless
* the data fits the criteria of the query.
*/
add(data: T): Promise<DocumentReference> {
return this.ref.add(data);
add(data: T): Promise<AngularFirestoreDocument<T>> {
return this.ref.add(data).then(doc => new AngularFirestoreDocument<T>(doc, this.afs));
}

/**
Expand Down