I've read this solution, but I still don't know how to count the number of documents in a collection with Python.
My code :
job = db.collection(u'netcollect_jobs').document('48c94805-1dab-4325-a927-f22f9c9b635d')
coll = job.collection('job_result_per_device')
coll_count = coll.count().get()
print(coll_count)
print(finished_device[0][0].value)
output :
[[<Aggregation alias=field_1, value=25003, readtime=2023-04-17 13:52:27.813282+00:00>]]
25003
Ok, I found the number of documents (25003), but it's weird to access it like I did (i.e [0][0].value
). I feel like what I did is not 'official' (not recommanded).
On documentation, I didn't find anything, neither in the github repo.
What's the best solution for achieve this ?