Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

Can i creat a view with only java code?

6 replies [Last post]
  • Login or register to post comments
Wed, 12/26/2012 - 01:58
kenhome
Offline
Joined: 12/20/2012
Groups: None

May be this is a stupid topic, if so, i apologize for this...
As you can see, i am the new user of couchbase. I am curious about can i create a view with only java code?
Regards,
kenhome

Top
  • Login or register to post comments
Wed, 12/26/2012 - 03:26
kenhome
Offline
Joined: 12/20/2012
Groups: None

I found this:
"To create view, you can use either the Admin Console edite,
use the REST API for design documents, or use one of the client
librarys that support view manager."
What's the more informations about one of the client librarys that support view manager?
Is that mean i can use java code? if so, how can i use for it?

Top
  • Login or register to post comments
Wed, 12/26/2012 - 04:37
tgrall
Offline
Joined: 09/05/2012
Groups: None

Yes you can, in the Java SDK 1.1.0 we have added the support to "Design Document".

This means you can create Views from a Java application. Here s very basic sample code :

        DesignDocument designDocument  = new DesignDocument("Beer_application");
        String viewName = "by_name";
        String map = "function (doc, meta) {\n" +
                "  emit(doc.name);\n" +
                "}";
        String reduce = "_count";
        ViewDesign viewDesign = new ViewDesign(viewName, map, reduce);
        designDocument.getViews().add(viewDesign);
        try {
            couchbaseClient.asyncCreateDesignDoc(designDocument);
        } catch (Exception e) {
            e.printStackTrace();
        }

__________________

Tug
@tgrall

Top
  • Login or register to post comments
Wed, 12/26/2012 - 23:21
kenhome
Offline
Joined: 12/20/2012
Groups: None

Thanks...

Top
  • Login or register to post comments
Sun, 12/30/2012 - 11:55
tgrall
Offline
Joined: 09/05/2012
Groups: None

Hello,

I have created a bog post about this:
http://tugdualgrall.blogspot.fr/2012/12/couchbase-101-create-views-mapre...

Regards
Tug

__________________

Tug
@tgrall

Top
  • Login or register to post comments
Thu, 01/03/2013 - 20:50
kenhome
Offline
Joined: 12/20/2012
Groups: None

I have been waiting for a few days,but it seems that the URL is invalid...

Top
  • Login or register to post comments
Fri, 01/04/2013 - 00:01
tgrall
Offline
Joined: 09/05/2012
Groups: None

Hello Kenhome,

Are you talking about the blog post URL?

Let's try with this short one: http://goo.gl/FSk2K

Regards
Tug

__________________

Tug
@tgrall

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker