Skip to content

Commit

Permalink
refactor(deprecation)!: remove deprecated getCollections() (#624)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian authored and JustinBeckwith committed May 15, 2019
1 parent e22f9c6 commit 43ac9c6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 62 deletions.
13 changes: 0 additions & 13 deletions dev/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,19 +812,6 @@ export class Firestore {
return rootDocument.listCollections();
}

/**
* Fetches the root collections that are associated with this Firestore
* database.
*
* @deprecated Use `.listCollections()`.
*
* @returns {Promise.<Array.<CollectionReference>>} A Promise that resolves
* with an array of CollectionReferences.
*/
getCollections() {
return this.listCollections();
}

/**
* Retrieves multiple documents from Firestore.
*
Expand Down
12 changes: 0 additions & 12 deletions dev/src/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,18 +307,6 @@ export class DocumentReference implements Serializable {
});
}

/**
* Fetches the subcollections that are direct children of this document.
*
* @deprecated Use `.listCollections()`.
*
* @returns {Promise.<Array.<CollectionReference>>} A Promise that resolves
* with an array of CollectionReferences.
*/
getCollections(): Promise<CollectionReference[]> {
return this.listCollections();
}

/**
* Create a document with the provided object values. This will fail the write
* if a document exists at its location.
Expand Down
18 changes: 7 additions & 11 deletions dev/test/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1952,17 +1952,13 @@ describe('listCollections() method', () => {
};

return createInstance(overrides).then(firestore => {
// We are using `getCollections()` to ensure 100% code coverage
return (
firestore
.doc('coll/doc')
// tslint:disable-next-line deprecation
.getCollections()
.then(collections => {
expect(collections[0].path).to.equal('coll/doc/first');
expect(collections[1].path).to.equal('coll/doc/second');
})
);
return firestore
.doc('coll/doc')
.listCollections()
.then(collections => {
expect(collections[0].path).to.equal('coll/doc/first');
expect(collections[1].path).to.equal('coll/doc/second');
});
});
});
});
4 changes: 1 addition & 3 deletions dev/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,7 @@ describe('listCollections() method', () => {
};

return createInstance(overrides).then(firestore => {
// We are using `getCollections()` to ensure 100% code coverage
// tslint:disable-next-line deprecation
return firestore.getCollections().then(collections => {
return firestore.listCollections().then(collections => {
expect(collections[0].path).to.equal('first');
expect(collections[1].path).to.equal('second');
});
Expand Down
4 changes: 0 additions & 4 deletions dev/test/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ xdescribe('firestore.d.ts', () => {
firestore
.getAll(docRef1, docRef2, {fieldMask: ['foo', new FieldPath('foo')]})
.then((docs: DocumentSnapshot[]) => {});
// tslint:disable-next-line deprecation
firestore.getCollections().then((collections: CollectionReference[]) => {});
firestore
.listCollections()
.then((collections: CollectionReference[]) => {});
Expand Down Expand Up @@ -154,8 +152,6 @@ xdescribe('firestore.d.ts', () => {
const parent: CollectionReference = docRef.parent;
const path: string = docRef.path;
const subcollection: CollectionReference = docRef.collection('coll');
// tslint:disable-next-line deprecation
docRef.getCollections().then((collections: CollectionReference[]) => {});
docRef.listCollections().then((collections: CollectionReference[]) => {});
docRef.get().then((snapshot: DocumentSnapshot) => {});
docRef
Expand Down
19 changes: 0 additions & 19 deletions types/firestore.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,6 @@ declare namespace FirebaseFirestore {
getAll(...documentRefsOrReadOptions: Array<DocumentReference|ReadOptions>):
Promise<DocumentSnapshot[]>;

/**
* Fetches the root collections that are associated with this Firestore
* database.
*
* @deprecated Use `.listCollections()`.
*
* @returns A Promise that resolves with an array of CollectionReferences.
*/
getCollections() : Promise<CollectionReference[]>;

/**
* Fetches the root collections that are associated with this Firestore
* database.
Expand Down Expand Up @@ -571,15 +561,6 @@ declare namespace FirebaseFirestore {
*/
collection(collectionPath: string): CollectionReference;

/**
* Fetches the subcollections that are direct children of this document.
*
* @deprecated Use `.listCollections()`.
*
* @returns A Promise that resolves with an array of CollectionReferences.
*/
getCollections() : Promise<CollectionReference[]>;

/**
* Fetches the subcollections that are direct children of this document.
*
Expand Down

0 comments on commit 43ac9c6

Please sign in to comment.