The following is stated in the official 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 the limit().
But I found the above statement false. I have stored the document ids as increment numbers 1,2,3...
But when I fetched the document IDs by the following code.
firebaseFirestore.collection(documentPathOnFireStore).get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
for(DocumentSnapshot documentSnapshot : task.getResult().getDocuments()){
documentsIds += documentSnapshot.getId() + ","
}
}});
I received the following results
1, 10, 100, 101, 102....
Is there really any way to get the result in ascending order of document Ids?