You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Kiril Stankov <ki...@open-net.biz> on 2015/03/09 13:56:10 UTC
How to get number of normal (non-design) documents in CouchDB?
Hi,
anyone aware of a way to get count of non-design documents in CouchDB?
Thanks in advance!
------------------------------------------------------------------------
*With best regards,*
Kiril Stankov
Re: How to get number of normal (non-design) documents in CouchDB?
Posted by Kiril Stankov <ki...@open-net.biz>.
Thanks a lot!
I like the second one... :)
------------------------------------------------------------------------
*With best regards,*
Kiril Stankov,
On 09-Mar-15 3:23 PM, Alexander Shorin wrote:
> No need to check for doc._id in a view since views doesn't indexed
> design documents by default. Just use a single emit(null, null) with
> _count to reduce index size.
> Another way to to make a two queries: GET /db and GET
> /db/_all_docs?startkey="_design"&endkey="_design0" and apply some math
> on total documents count and amount of returned design docs.
>
>
> --
> ,,,^..^,,,
>
>
> On Mon, Mar 9, 2015 at 4:00 PM, Kiril Stankov <ki...@open-net.biz> wrote:
>> Well,
>>
>> I think I figured it out. I can create a view and check for doc._id not
>> starting with '_design' and then use _count.
>> But as I expect to have thousands of documents I'd rather not create a view
>> just for counting docs...
>> Anyone with better idea?
>>
>> ------------------------------------------------------------------------
>> *With best regards,*
>> Kiril Stankov
>>
>> On 09-Mar-15 2:56 PM, Kiril Stankov wrote:
>>> Hi,
>>> anyone aware of a way to get count of non-design documents in CouchDB?
>>> Thanks in advance!
>>> ------------------------------------------------------------------------
>>> *With best regards,*
>>> Kiril Stankov
>>>
>>>
>>>
Re: How to get number of normal (non-design) documents in CouchDB?
Posted by Alexander Shorin <kx...@gmail.com>.
No need to check for doc._id in a view since views doesn't indexed
design documents by default. Just use a single emit(null, null) with
_count to reduce index size.
Another way to to make a two queries: GET /db and GET
/db/_all_docs?startkey="_design"&endkey="_design0" and apply some math
on total documents count and amount of returned design docs.
--
,,,^..^,,,
On Mon, Mar 9, 2015 at 4:00 PM, Kiril Stankov <ki...@open-net.biz> wrote:
> Well,
>
> I think I figured it out. I can create a view and check for doc._id not
> starting with '_design' and then use _count.
> But as I expect to have thousands of documents I'd rather not create a view
> just for counting docs...
> Anyone with better idea?
>
> ------------------------------------------------------------------------
> *With best regards,*
> Kiril Stankov
>
> On 09-Mar-15 2:56 PM, Kiril Stankov wrote:
>>
>> Hi,
>> anyone aware of a way to get count of non-design documents in CouchDB?
>> Thanks in advance!
>> ------------------------------------------------------------------------
>> *With best regards,*
>> Kiril Stankov
>>
>>
>>
>
Re: How to get number of normal (non-design) documents in CouchDB?
Posted by Kiril Stankov <ki...@open-net.biz>.
Well,
I think I figured it out. I can create a view and check for doc._id not
starting with '_design' and then use _count.
But as I expect to have thousands of documents I'd rather not create a
view just for counting docs...
Anyone with better idea?
------------------------------------------------------------------------
*With best regards,*
Kiril Stankov
On 09-Mar-15 2:56 PM, Kiril Stankov wrote:
> Hi,
> anyone aware of a way to get count of non-design documents in CouchDB?
> Thanks in advance!
> ------------------------------------------------------------------------
> *With best regards,*
> Kiril Stankov
>
>
>