# How to know total number of purged documents for a user?

**URL:** <https://forum.communityhealthtoolkit.org/t/how-to-know-total-number-of-purged-documents-for-a-user/2398>\
**Category:** Development\
**Tags:** meta\
**Created:** [January 13, 2023, 12:02am UTC](https://forum.communityhealthtoolkit.org/t/how-to-know-total-number-of-purged-documents-for-a-user/2398 "2023-01-13T00:02:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuv](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/yuv/32/320_2.png) [@yuv](https://forum.communityhealthtoolkit.org/u/yuv)\
**Post date:** [January 13, 2023, 12:02am UTC](https://forum.communityhealthtoolkit.org/t/how-to-know-total-number-of-purged-documents-for-a-user/2398/1 "2023-01-13T00:02:21Z")

</div>

Since purging can reduce the number of documents that reside on users’ devices, how do I know how many documents are actually residing on user’s device vs how many documents user actually created? `dbinfo.doc_count` in [telemetry documentation](https://docs.communityhealthtoolkit.org/apps/guides/performance/telemetry/) mentions that this field represents the total number of docs in the local database. Does this discount the purged documents? If it discounts purged documents as of the telemetry collected date, how do I know how many documents user actually created?

---

<div class="post-metadata">

**Author:** ![diana](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/diana/32/2049_2.png) [@diana](https://forum.communityhealthtoolkit.org/u/diana)\
**Post date:** [January 13, 2023, 6:21am UTC](https://forum.communityhealthtoolkit.org/t/how-to-know-total-number-of-purged-documents-for-a-user/2398/2 "2023-01-13T06:21:09Z")

</div>

Hi @yirimal

At this time, there is no service that provides the number of purged documents for a certain user.  
If this is a feature that is useful, we can add it. Please submit an issue describing your use case and how you’d ideally like this information be available.

To note:

- this information will only be available on the server. the client _can_ request it though, but it might get stale quickly
- this information is often subject to change (every time the purge runs, this number can change)

---

<div class="post-metadata">

**Author:** ![yuv](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/yuv/32/320_2.png) [@yuv](https://forum.communityhealthtoolkit.org/u/yuv)\
**Post date:** [January 17, 2023, 8:37pm UTC](https://forum.communityhealthtoolkit.org/t/how-to-know-total-number-of-purged-documents-for-a-user/2398/3 "2023-01-17T20:37:32Z")

</div>

Hi @diana ,  
Thank you for response. Having this information would be really helpful and I’d create a request regarding this. In the mean time, can you answer this question?

- Which records does `dbinfo.doc_count` in telemetry display? Does it display the total number of records a user created without discounting purged records?

---

<div class="post-metadata">

**Author:** ![diana](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/diana/32/2049_2.png) [@diana](https://forum.communityhealthtoolkit.org/u/diana)\
**Post date:** [January 18, 2023, 3:56am UTC](https://forum.communityhealthtoolkit.org/t/how-to-know-total-number-of-purged-documents-for-a-user/2398/4 "2023-01-18T03:56:38Z")

</div>

Hi @yuv

> Which records does `dbinfo.doc_count` in telemetry display

`doc_count` is the total number of documents that exist in the user’s local database. These documents are definitely not all created by the user (as it will include the homeplace and the user’s contact for example, which are for sure created by some supervisor or admin).

The whole `dbinfo` object is the unaltered result of the PouchDb `info` call ([cht-core/admin/src/js/services/telemetry.js at 275e5adc647f0e5c8cce7feaa2d496697b956622 · medic/cht-core · GitHub](https://github.com/medic/cht-core/blob/275e5adc647f0e5c8cce7feaa2d496697b956622/admin/src/js/services/telemetry.js#L189)).  
This call returns a [bunch of values](https://pouchdb.com/api.html#database_information), with `doc_count` among them.
