On Sat, Dec 18, 2010 at 12:13 PM, Josh803316 <[email protected]> wrote:
> Speed is important in the case of this request so I guess a view is the way
> to go.
>
> I have a very simple 'status' key for all my docs
>
> 'status': 'IDLE' or 'status':'RUNNING'
>
> I just want to get a quick grab of the status instead of the entire doc, so
> I wasn't sure if a view or show was better.
>
> Would it be best to just use a startkey_docid and endkey_docid as the same
> value so that my view would be limited to one doc result? Just looking for
> the best practice on returning the one doc value.
I'd try testing both of these emit calls:
emit(doc._id, doc.status)
or
emit(doc.status, null)
For the second version you'd need to use startkey_docid/endkey_docid.
The first is obviously just a ?key="docid"
HTH,
Paul Davis
> On Sat, Dec 18, 2010 at 11:03 AM, Paul Davis
> <[email protected]>wrote:
>
>> On Sat, Dec 18, 2010 at 11:56 AM, Josh803316 <[email protected]> wrote:
>> > Question:
>> > If I know my doc id and my key name, what url should I get to find the
>> value
>> > of a single key in a document? Does this have to be done in a created
>> view
>> > by sending the id to the view as part of the query string and returning
>> only
>> > the value where the passed query.value.id matches that doc._id?
>> > Just wondering if there was a builtin way to get the value from a single
>> doc
>> > or if it required a view.
>> >
>>
>> You could do it with a _show. Though technically a view would probably
>> be faster. Especially if you have common combinations of doc id/keys.
>>
>> HTH,
>> Paul Davis
>>
>