couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh803316 <josh803...@gmail.com>
Subject Re: Getting the value of a key in a single doc(Does this require a view)
Date Sat, 18 Dec 2010 17:13:53 GMT
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.

On Sat, Dec 18, 2010 at 11:03 AM, Paul Davis <paul.joseph.davis@gmail.com>wrote:

> On Sat, Dec 18, 2010 at 11:56 AM, Josh803316 <josh803316@gmail.com> 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message