Firestore DeadlineExceeded exception for big collections
After some help from the firebase support team we were able to figure out that there is indeed a bug with the python client api. There is a bugfix coming in one of the next releases. Most likely it will enable the python library to sort by documentid and therefore use start_after()
.
Up until then you have two possible solutions:
use another field to sort on and use
start_after()
use the node.js library with paging like:
var db = admin.firestore();
admin.firestore().settings({ timestampsInSnapshots: true });
function readNextPage(lastReadDoc) {
let query = db
.collection(collection)
.orderBy(admin.firestore.FieldPath.documentId())
.limit(100);
}