You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by erich oliphant <er...@gmail.com> on 2010/04/28 00:36:28 UTC

results without couch 'metadata'

Hi is there a way to get couch results without the extra metadata?  Perhaps
instead of 'include_docs' where you get:

{"total_rows":1498,"offset":350,"rows":[{"id":"1","key":"1","doc":{"_id":"1","_rev":"1","important":"stuff"}}]}

a 'docs_only' or something  option that would return something like
{[{"important","stuff"}]}

-- 
Erich Oliphant

"There are, in fact, two things, science and opinion, the former begets
knowledge, the latter ignorance"
-- Hippocrates of Cos

Re: results without couch 'metadata'

Posted by J Chris Anderson <jc...@gmail.com>.
On Apr 30, 2010, at 1:39 PM, erich oliphant wrote:

> Ok, but do I have to regen JSON manually in this casem since the _list
> function is designed to spit out arbitrary formats ?


yes you can return JSON.stringify({"foo":5})

> 
> On Wed, Apr 28, 2010 at 12:58 PM, Paul Bonser <mi...@gmail.com> wrote:
> 
>> And of course, it didn't occur to me to mention that there was already
>> an even more general solution already in place...
>> 
>> On Tue, Apr 27, 2010 at 7:47 PM, Chris Anderson <jc...@gmail.com> wrote:
>>> You can use a _list or _show function for this.
>>> 
>>> Sent from my iPhone
>>> 
>>> On Apr 27, 2010, at 4:47 PM, Paul Bonser <mi...@gmail.com> wrote:
>>> 
>>>> I'm pretty sure there is no such thing, but if it was to be added, I
>>>> think it would be better to add something a little more general, such
>>>> as "just_field" so you could do something like
>>>> ?just_field=id/key/doc/value to get a list of all the
>>>> ids/keys/docs/values, respectively.
>>>> 
>>>> I don't like the name "just_field", that's just the first thing that
>>>> came to mind, but I could see such a feature being useful.
>>>> 
>>>> There'd be no need to wrap an extra doc around it, it could just be a
>>>> json array returned, and it wouldn't make sense to strip out the _id
>>>> and _rev, so with your example, you'd end up with the following being
>>>> returned:
>>>> 
>>>>  [
>>>>  {"_id":"1","_rev":"1","important":"stuff"}
>>>>  ]
>>>> 
>>>> On Tue, Apr 27, 2010 at 5:36 PM, erich oliphant
>>>> <er...@gmail.com> wrote:
>>>>> 
>>>>> Hi is there a way to get couch results without the extra metadata?
>>>>> Perhaps
>>>>> instead of 'include_docs' where you get:
>>>>> 
>>>>> 
>>>>> 
>> {"total_rows":1498,"offset":350,"rows":[{"id":"1","key":"1","doc":{"_id":"1","_rev":"1","important":"stuff"}}]}
>>>>> 
>>>>> a 'docs_only' or something  option that would return something like
>>>>> {[{"important","stuff"}]}
>>>>> 
>>>>> --
>>>>> Erich Oliphant
>>>>> 
>>>>> "There are, in fact, two things, science and opinion, the former begets
>>>>> knowledge, the latter ignorance"
>>>>> -- Hippocrates of Cos
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Paul Bonser
>>>> http://probablyprogramming.com
>>> 
>> 
>> 
>> 
>> --
>> Paul Bonser
>> http://probablyprogramming.com
>> 
> 
> 
> 
> -- 
> Erich Oliphant
> 
> "There are, in fact, two things, science and opinion, the former begets
> knowledge, the latter ignorance"
> -- Hippocrates of Cos


Re: results without couch 'metadata'

Posted by erich oliphant <er...@gmail.com>.
Ok, but do I have to regen JSON manually in this casem since the _list
function is designed to spit out arbitrary formats ?

On Wed, Apr 28, 2010 at 12:58 PM, Paul Bonser <mi...@gmail.com> wrote:

> And of course, it didn't occur to me to mention that there was already
> an even more general solution already in place...
>
> On Tue, Apr 27, 2010 at 7:47 PM, Chris Anderson <jc...@gmail.com> wrote:
> > You can use a _list or _show function for this.
> >
> > Sent from my iPhone
> >
> > On Apr 27, 2010, at 4:47 PM, Paul Bonser <mi...@gmail.com> wrote:
> >
> >> I'm pretty sure there is no such thing, but if it was to be added, I
> >> think it would be better to add something a little more general, such
> >> as "just_field" so you could do something like
> >> ?just_field=id/key/doc/value to get a list of all the
> >> ids/keys/docs/values, respectively.
> >>
> >> I don't like the name "just_field", that's just the first thing that
> >> came to mind, but I could see such a feature being useful.
> >>
> >> There'd be no need to wrap an extra doc around it, it could just be a
> >> json array returned, and it wouldn't make sense to strip out the _id
> >> and _rev, so with your example, you'd end up with the following being
> >> returned:
> >>
> >>   [
> >>   {"_id":"1","_rev":"1","important":"stuff"}
> >>   ]
> >>
> >> On Tue, Apr 27, 2010 at 5:36 PM, erich oliphant
> >> <er...@gmail.com> wrote:
> >>>
> >>> Hi is there a way to get couch results without the extra metadata?
> >>>  Perhaps
> >>> instead of 'include_docs' where you get:
> >>>
> >>>
> >>>
> {"total_rows":1498,"offset":350,"rows":[{"id":"1","key":"1","doc":{"_id":"1","_rev":"1","important":"stuff"}}]}
> >>>
> >>> a 'docs_only' or something  option that would return something like
> >>> {[{"important","stuff"}]}
> >>>
> >>> --
> >>> Erich Oliphant
> >>>
> >>> "There are, in fact, two things, science and opinion, the former begets
> >>> knowledge, the latter ignorance"
> >>> -- Hippocrates of Cos
> >>>
> >>
> >>
> >>
> >> --
> >> Paul Bonser
> >> http://probablyprogramming.com
> >
>
>
>
> --
> Paul Bonser
> http://probablyprogramming.com
>



-- 
Erich Oliphant

"There are, in fact, two things, science and opinion, the former begets
knowledge, the latter ignorance"
-- Hippocrates of Cos

Re: results without couch 'metadata'

Posted by Paul Bonser <mi...@gmail.com>.
And of course, it didn't occur to me to mention that there was already
an even more general solution already in place...

On Tue, Apr 27, 2010 at 7:47 PM, Chris Anderson <jc...@gmail.com> wrote:
> You can use a _list or _show function for this.
>
> Sent from my iPhone
>
> On Apr 27, 2010, at 4:47 PM, Paul Bonser <mi...@gmail.com> wrote:
>
>> I'm pretty sure there is no such thing, but if it was to be added, I
>> think it would be better to add something a little more general, such
>> as "just_field" so you could do something like
>> ?just_field=id/key/doc/value to get a list of all the
>> ids/keys/docs/values, respectively.
>>
>> I don't like the name "just_field", that's just the first thing that
>> came to mind, but I could see such a feature being useful.
>>
>> There'd be no need to wrap an extra doc around it, it could just be a
>> json array returned, and it wouldn't make sense to strip out the _id
>> and _rev, so with your example, you'd end up with the following being
>> returned:
>>
>>   [
>>   {"_id":"1","_rev":"1","important":"stuff"}
>>   ]
>>
>> On Tue, Apr 27, 2010 at 5:36 PM, erich oliphant
>> <er...@gmail.com> wrote:
>>>
>>> Hi is there a way to get couch results without the extra metadata?
>>>  Perhaps
>>> instead of 'include_docs' where you get:
>>>
>>>
>>> {"total_rows":1498,"offset":350,"rows":[{"id":"1","key":"1","doc":{"_id":"1","_rev":"1","important":"stuff"}}]}
>>>
>>> a 'docs_only' or something  option that would return something like
>>> {[{"important","stuff"}]}
>>>
>>> --
>>> Erich Oliphant
>>>
>>> "There are, in fact, two things, science and opinion, the former begets
>>> knowledge, the latter ignorance"
>>> -- Hippocrates of Cos
>>>
>>
>>
>>
>> --
>> Paul Bonser
>> http://probablyprogramming.com
>



-- 
Paul Bonser
http://probablyprogramming.com

Re: results without couch 'metadata'

Posted by Chris Anderson <jc...@gmail.com>.
You can use a _list or _show function for this.

Sent from my iPhone

On Apr 27, 2010, at 4:47 PM, Paul Bonser <mi...@gmail.com> wrote:

> I'm pretty sure there is no such thing, but if it was to be added, I
> think it would be better to add something a little more general, such
> as "just_field" so you could do something like
> ?just_field=id/key/doc/value to get a list of all the
> ids/keys/docs/values, respectively.
>
> I don't like the name "just_field", that's just the first thing that
> came to mind, but I could see such a feature being useful.
>
> There'd be no need to wrap an extra doc around it, it could just be a
> json array returned, and it wouldn't make sense to strip out the _id
> and _rev, so with your example, you'd end up with the following being
> returned:
>
>    [
>    {"_id":"1","_rev":"1","important":"stuff"}
>    ]
>
> On Tue, Apr 27, 2010 at 5:36 PM, erich oliphant
> <er...@gmail.com> wrote:
>> Hi is there a way to get couch results without the extra metadata?   
>> Perhaps
>> instead of 'include_docs' where you get:
>>
>> {"total_rows":1498,"offset":350,"rows":[{"id":"1","key":"1","doc": 
>> {"_id":"1","_rev":"1","important":"stuff"}}]}
>>
>> a 'docs_only' or something  option that would return something like
>> {[{"important","stuff"}]}
>>
>> --
>> Erich Oliphant
>>
>> "There are, in fact, two things, science and opinion, the former  
>> begets
>> knowledge, the latter ignorance"
>> -- Hippocrates of Cos
>>
>
>
>
> -- 
> Paul Bonser
> http://probablyprogramming.com

Re: results without couch 'metadata'

Posted by Paul Bonser <mi...@gmail.com>.
I'm pretty sure there is no such thing, but if it was to be added, I
think it would be better to add something a little more general, such
as "just_field" so you could do something like
?just_field=id/key/doc/value to get a list of all the
ids/keys/docs/values, respectively.

I don't like the name "just_field", that's just the first thing that
came to mind, but I could see such a feature being useful.

There'd be no need to wrap an extra doc around it, it could just be a
json array returned, and it wouldn't make sense to strip out the _id
and _rev, so with your example, you'd end up with the following being
returned:

    [
    {"_id":"1","_rev":"1","important":"stuff"}
    ]

On Tue, Apr 27, 2010 at 5:36 PM, erich oliphant
<er...@gmail.com> wrote:
> Hi is there a way to get couch results without the extra metadata?  Perhaps
> instead of 'include_docs' where you get:
>
> {"total_rows":1498,"offset":350,"rows":[{"id":"1","key":"1","doc":{"_id":"1","_rev":"1","important":"stuff"}}]}
>
> a 'docs_only' or something  option that would return something like
> {[{"important","stuff"}]}
>
> --
> Erich Oliphant
>
> "There are, in fact, two things, science and opinion, the former begets
> knowledge, the latter ignorance"
> -- Hippocrates of Cos
>



-- 
Paul Bonser
http://probablyprogramming.com