I have been reading https://firebase.flutter.dev/docs/firestore/usage/ and still do not understand yet. Documents are super confused. What are differences?
1 Isn't the code above and the code below the same?
FirebaseFirestore.instance
.collection('users')
.orderBy('age')
.orderBy('company')
.startAt([4, 'Alphabet Inc.'])
.endAt([21, 'Google LLC'])
.get()
.then(...);
FirebaseFirestore.instance
.collection('users')
.where("age", isGreaterThanOrEqualTo: 4)
.where("company", isGreaterThanOrEqualTo: 'Alphabet Inc.')
.where("age", isLessThanOrEqualTo: 21)
.where("company", isLessThanOrEqualTo: 'Google LLC')
.orderBy('age')
.orderBy('company')
.get()
.then(...);
2 I think this also has the same function as No. 1, doesn't it?
DocumentSnapshot documentSnapshot = await FirebaseFirestore.instance
.collection('users')
.orderBy('age')
.orderBy('company')
.startAt([4, 'Alphabet Inc.'])
.endAt([21, 'Google LLC'])
.get();
FirebaseFirestore.instance
.collection('users')
.orderBy('age')
.orderBy('company')
.startAfterDocument(documentSnapshot)
.get();
3 https://firebase.google.com/docs/firestore/query-data/query-cursors
this is not flutter code but you can see these lines
DocumentSnapshot lastVisible = documentSnapshots.getDocuments()
.get(documentSnapshots.size() -1);
// Construct a new query starting at this document,
// get the next 25 cities.
Query next = db.collection("cities")
.orderBy("population")
.startAfter(lastVisible)
.limit(25)
It's not even startAfterDocument, but at startAfter, a raw document is being entered as a parameter. What happened? Doesn't flutter have something like this?