I need to get all the users count from superuser and list those in a table view with there details. Is there a code to directly get the count of documents inside a collection, other than using functions inside firebase console. Or a Simple Query to traverse through the documents!
this will collect all the document for a collection and print them
db.collection("superUsers").getDocuments()
{
(querySnapshot, err) in
if let err = err
{
print("Error getting documents: \(err)");
}
else
{
var count = 0
for document in querySnapshot!.documents {
count += 1
print("\(document.documentID) => \(document.data())");
}
print("Count = \(count)");
}
}