Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit db8a218

Browse files
Firestore note about indexes when using where clauses
1 parent c7c6e45 commit db8a218

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/FIRESTORE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ firebase.firestore().collection("dogs").doc("fave")
242242
### Ordering and limiting results of `collection.where()`
243243
Return data sorted (asc or desc), or limit to a certain number of results:
244244

245+
> Make sure to checkt the comment on the `.catch` below.
246+
245247
```typescript
246248
const citiesCollection = firebase.firestore().collection("cities");
247249

@@ -257,7 +259,7 @@ query
257259
querySnapshot.forEach(doc => {
258260
console.log(`Large Californian city: ${doc.id} => ${JSON.stringify(doc.data())}`);
259261
});
260-
});
262+
}).catch(err => console.log(err)); // make sure you add this because Firestore may request you to create an index for this query!
261263
```
262264

263265
### Paginate data with query cursors

0 commit comments

Comments
 (0)