Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a default limit of Firestore query?

Let's say I have a collection mycollection that has 1,000,000 records.

How many records will this query return?

const query = firestore.collection('mycollection').get()

I couldn't find that in docs.

like image 617
Andrey Gordeev Avatar asked Apr 24 '19 06:04

Andrey Gordeev


1 Answers

There is no default limit. The query you're showing is asking for all of the documents in mycollection. For large collections, you will need to impose a limit in order to avoid excessive costs and running out of memory.

From firebase.google.com documentation:

By default, a query retrieves all documents that satisfy the query in ascending order by document ID. You can specify the sort order for your data using orderBy(), and you can limit the number of documents retrieved using limit().

like image 117
Doug Stevenson Avatar answered Oct 13 '22 10:10

Doug Stevenson