You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by David Caylor <dc...@fh.org> on 2011/07/06 17:37:07 UTC

Re: Need help in couchDB views

The error is indicating that your view isn't named title_3.  Double check
that you're using the right view name.

On Tue, Jul 5, 2011 at 11:56 PM, srikanth <Sr...@dell.com>wrote:

> Hi,
>
> I am new to couchdb and followed some tutorials to create views.
>
> I was able to query the database using the HTTP request by creating some
> views.
> But later after some one week time, when i tried the same program, it gave
> me
> the following error....
>
> Query is:
> HttpGet get = new
> HttpGet("
> http://160.110.185.152:5984/employee/_design/couchview/_view/title_3");
>
>
> Error is:
> {"error":"not_found","reason":"missing_named_view"}
>
> I check that the view is already present in the couchdb.
>
> Can anyone help me on how to resolve this?
>
> Thanks
> Srikanth
>
>

Re: Need help in couchDB views

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 15 July 2011 23:02, Srikanth <sr...@dell.com> wrote:
> Dave Cottlehuber <da...@...> writes:
>
>>
>> On 15 July 2011 18:01, Srikanth <sr...@...> wrote:
>> >
>> >> On 14 July 2011 20:03, Srikanth <sr...@...> wrote:
>> >> > David Caylor <dc...@...> writes:
>> >> >> The error is indicating that your view isn't named title_3.  Double
> check
>> >> >> that you're using the right view name.
>>
>> > Link to this snippet:   http://friendpaste.com/1e1K2vQyAKa2fUBrLMWL3d
>> > Embed:
>>
>> Hey Srikanth,
>>
>> This code isn't from your original ddoc, contains irrelevant code, and
>> no view called title_3 anyway. If you're expecting the community to
>> help you please put more effort into enabling us to do so.
>>
>> Cheers
>> Dave
>>
>>sorry Dave,
> Actually i tried so many ways to figure out the error, so by mistake it
> happened.
>
> I pasted the code now.
>
> http://friendpaste.com/1e1K2vQyAKa2fUBrLMWL3d
>
>
> Srikanth

Hi Srikanth,

It looks like you are getting confused in how the various
views/shows/filters/.... all get bundled up into a design doc. Best to
read the definitive guide first few chapters first.

Then I suggest you sign up for a hosted couchdb at
http://iriscouch.com/ its free and we'll be able to see directly
what's getting you stuck.

Put a few docs in there, and then try to create a ddocs & view by
creating views in futon directly
http://blog.vicmetcalfe.com/2011/04/11/creating-views-in-couchdb-futon/

And here's an example ddoc - note the "views" is where you see your functions -

{
   "_id": "_design/ddoc",
   "_rev": "1-21543a52cccf1ec7a1e23ab5fcfe444a",
   "views": {
       "animals": {
           "map": "function(doc) {\n  if (doc.animal && doc.attribute)
{\n    emit(doc.animal, doc.attribute);\n  }\n};"
       }
   }
}

you can take a further look here
http://muse.iriscouch.com/_utils/database.html?srik/_all_docs

A+
Dave

Re: Need help in couchDB views

Posted by Srikanth <sr...@dell.com>.
Mehdi El Fadil <me...@...> writes:

> 
> Srikanth,
> 
> There is still no view in the code you pasted, filter and views are
> different things. Syntax for the view functions is different from syntax of
> your title_3 filter.
> 
> View should have a map function, and optionally a reduce function, have a
> look here:
> http://guide.couchdb.org/draft/design.html
> 
> How did you do to create the view? I advice you to try to create it from
> futon.
> 
> Good luck
> 
> On Fri, Jul 15, 2011 at 1:02 PM, Srikanth <sr...@...>wrote:
> 
> > Dave Cottlehuber <da...@...> writes:
> >
> > >
> > > On 15 July 2011 18:01, Srikanth <sr...@...> wrote:
> > > >
> > > >> On 14 July 2011 20:03, Srikanth <sr...@...> wrote:
> > > >> > David Caylor <dc...@...> writes:
> > > >> >> The error is indicating that your view isn't named title_3.  Double
> > check
> > > >> >> that you're using the right view name.
> > >
> > > > Link to this snippet:   http://friendpaste.com/1e1K2vQyAKa2fUBrLMWL3d
> > > > Embed:
> > >
> > > Hey Srikanth,
> > >
> > > This code isn't from your original ddoc, contains irrelevant code, and
> > > no view called title_3 anyway. If you're expecting the community to
> > > help you please put more effort into enabling us to do so.
> > >
> > > Cheers
> > > Dave
> > >
> > >sorry Dave,
> > Actually i tried so many ways to figure out the error, so by mistake it
> > happened.
> >
> > I pasted the code now.
> >
> > http://friendpaste.com/1e1K2vQyAKa2fUBrLMWL3d
> >
> >
> > Srikanth
> >
> >
> >Thanks Dave,

when i tried to create using Futon it worked properly.

But when i tried to create the same using java api it dint work.

here is the java code for a sample view that i created.

doc.setId("_design/couchviewsample");
					
		String str = "{\"searchText\": {\"map\": \"function(doc) { if 
(doc.title == 'Document-3')  emit(null, doc) } \"}}";
		
				
		doc.put("views", str); 
		db.saveDocument(doc);

Is there any error in creating the view like this?

Thanks
Srikanth

> >
> >
> >
> >
> 





Re: Need help in couchDB views

Posted by Mehdi El Fadil <me...@mango-is.com>.
Srikanth,

There is still no view in the code you pasted, filter and views are
different things. Syntax for the view functions is different from syntax of
your title_3 filter.

View should have a map function, and optionally a reduce function, have a
look here:
http://guide.couchdb.org/draft/design.html

How did you do to create the view? I advice you to try to create it from
futon.

Good luck



On Fri, Jul 15, 2011 at 1:02 PM, Srikanth <sr...@dell.com>wrote:

> Dave Cottlehuber <da...@...> writes:
>
> >
> > On 15 July 2011 18:01, Srikanth <sr...@...> wrote:
> > >
> > >> On 14 July 2011 20:03, Srikanth <sr...@...> wrote:
> > >> > David Caylor <dc...@...> writes:
> > >> >> The error is indicating that your view isn't named title_3.  Double
> check
> > >> >> that you're using the right view name.
> >
> > > Link to this snippet:   http://friendpaste.com/1e1K2vQyAKa2fUBrLMWL3d
> > > Embed:
> >
> > Hey Srikanth,
> >
> > This code isn't from your original ddoc, contains irrelevant code, and
> > no view called title_3 anyway. If you're expecting the community to
> > help you please put more effort into enabling us to do so.
> >
> > Cheers
> > Dave
> >
> >sorry Dave,
> Actually i tried so many ways to figure out the error, so by mistake it
> happened.
>
> I pasted the code now.
>
> http://friendpaste.com/1e1K2vQyAKa2fUBrLMWL3d
>
>
> Srikanth
>
>
>
>
>
>
>


-- 
*
Mehdi El Fadil
*
<http://www.mango-is.com>

Re: Need help in couchDB views

Posted by Srikanth <sr...@dell.com>.
Dave Cottlehuber <da...@...> writes:

> 
> On 15 July 2011 18:01, Srikanth <sr...@...> wrote:
> >
> >> On 14 July 2011 20:03, Srikanth <sr...@...> wrote:
> >> > David Caylor <dc...@...> writes:
> >> >> The error is indicating that your view isn't named title_3.  Double 
check
> >> >> that you're using the right view name.
> 
> > Link to this snippet:   http://friendpaste.com/1e1K2vQyAKa2fUBrLMWL3d
> > Embed:
> 
> Hey Srikanth,
> 
> This code isn't from your original ddoc, contains irrelevant code, and
> no view called title_3 anyway. If you're expecting the community to
> help you please put more effort into enabling us to do so.
> 
> Cheers
> Dave
> 
>sorry Dave,
Actually i tried so many ways to figure out the error, so by mistake it 
happened.

I pasted the code now.

http://friendpaste.com/1e1K2vQyAKa2fUBrLMWL3d


Srikanth

 





Re: Need help in couchDB views

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 15 July 2011 18:01, Srikanth <sr...@dell.com> wrote:
>
>> On 14 July 2011 20:03, Srikanth <sr...@...> wrote:
>> > David Caylor <dc...@...> writes:
>> >> The error is indicating that your view isn't named title_3.  Double check
>> >> that you're using the right view name.

> Link to this snippet:   http://friendpaste.com/1e1K2vQyAKa2fUBrLMWL3d
> Embed:

Hey Srikanth,

This code isn't from your original ddoc, contains irrelevant code, and
no view called title_3 anyway. If you're expecting the community to
help you please put more effort into enabling us to do so.

Cheers
Dave

Re: Need help in couchDB views

Posted by Srikanth <sr...@dell.com>.
Dave Cottlehuber <da...@...> writes:

> 
> On 14 July 2011 20:03, Srikanth <sr...@...> wrote:
> > David Caylor <dc...@...> writes:
> >> The error is indicating that your view isn't named title_3.  Double check
> >> that you're using the right view name.
> >
> >
> > hi David,
> > when i saw it in the design document, the view named "title_3" was there in 
the
> > database.
> >
> 
> Can you put your ddoc up on friendpaste.com ?
> 
> ya i put that code in friendpaste.com....


Link to this snippet:	http://friendpaste.com/1e1K2vQyAKa2fUBrLMWL3d
Embed:	






Re: Need help in couchDB views

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 14 July 2011 20:03, Srikanth <sr...@dell.com> wrote:
> David Caylor <dc...@...> writes:
>> The error is indicating that your view isn't named title_3.  Double check
>> that you're using the right view name.
>
>
> hi David,
> when i saw it in the design document, the view named "title_3" was there in the
> database.
>

Can you put your ddoc up on friendpaste.com ?

Re: Need help in couchDB views

Posted by Srikanth <sr...@dell.com>.
David Caylor <dc...@...> writes:
> The error is indicating that your view isn't named title_3.  Double check
> that you're using the right view name.


hi David,
when i saw it in the design document, the view named "title_3" was there in the 
database.