incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srikanth <srikanth_kollip...@dell.com>
Subject Re: Need help in couchDB views
Date Mon, 18 Jul 2011 06:23:11 GMT
Mehdi El Fadil <mehdi.elfadil@...> 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 <srikanth_kollipara@...>wrote:
> 
> > Dave Cottlehuber <dave@...> writes:
> >
> > >
> > > On 15 July 2011 18:01, Srikanth <srikanth_kollipara@...> wrote:
> > > >
> > > >> On 14 July 2011 20:03, Srikanth <srikanth_kollipara@...> wrote:
> > > >> > David Caylor <dcaylor@...> 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

> >
> >
> >
> >
> 





Mime
View raw message