databasenosqlcouchdbcouchdb-mango

couchdb showing different record count with pagination?


I wanted to calculate how many records couchDB has for a database. So hit the below API and it returns json which has records count as well.

   GET http://localhost:20984/mydb/

jSON

{
    "db_name": "mydb",
    "update_seq": "25577-g1AAAAFLeJ4mDJtXMoSQMrqYcpacSjLYwGSDA1ACqhyPljpJ7xKF0CU7gcrXYlX6QGI0vtgpWJ4lT6AKIW4tTYLACqwZ0c",
    "sizes": {
        "file": 20881199,
        "external": 11977342,
        "active": 16542736
    },
    "purge_seq": 0,
    "other": {
        "data_size": 11977342
    },
    "doc_del_count": 0,
    "doc_count": 25569,
    "disk_size": 20881199,
    "disk_format_version": 6,
    "data_size": 16542736,
    "compact_running": false,
    "cluster": {
        "q": 8,
        "n": 1,
        "w": 1,
        "r": 1
    },
    "instance_start_time": "0"
}

Here doc_count is 25569 so i assume total records are 25569.

But when i set document_per_page to 100 & begin to view the records it shows 100 records for first page & 200 records for 2 pages & so on. And if i keep doing this way it shows me more than 35000 records.

Now my question is if total records are 25569 then how couchDB is showing me records more than 35000 with pagination ?


Solution

  • You're right about doc_count, it reports the number of documents in the specified database.

    Presuming you're using Fauxton and in there, you switch "Documents per page" to 100, I was able to reproduce the described behavior. When I repeatedly press the next arrow in a short interval, the displayed data and the numbers on the paginator went out of sync. Therefore this seems to be a bug of Fauxton.