Fix issue 1069

This commit is contained in:
Sam Stern
2018-12-21 15:38:57 -08:00
parent f960a7ff8c
commit 9aa18efa9a

View File

@@ -103,6 +103,10 @@ export class FirestoreIndexes {
});
const indexes = res.body.indexes;
if (!indexes) {
return [];
}
return indexes.map(
(index: any): API.Index => {
// Ignore any fields that point at the document ID, as those are implied
@@ -136,6 +140,12 @@ export class FirestoreIndexes {
const fields = res.body.fields as API.Field[];
// This should never be the case, since the API always returns the __default__
// configuration, but this is a defensive check.
if (!fields) {
return [];
}
// Ignore the default config, only list other fields.
return fields.filter((field) => {
return field.name.indexOf("__default__") < 0;