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

Create design documents from API

6 replies [Last post]
  • Login or register to post comments
Mon, 04/23/2012 - 06:43
Pathe
Offline
Joined: 04/23/2012
Groups: None

When adding new design documents through the API, the document shows up in the default bucket: "_design/dev_users" but not in the views.

https://gist.github.com/2470976

Any ideas?

Top
  • Login or register to post comments
Mon, 04/30/2012 - 02:42
Pathe
Offline
Joined: 04/23/2012
Groups: None

Anything?

Top
  • Login or register to post comments
Mon, 05/07/2012 - 10:52
BigBlueHat
Offline
Joined: 01/28/2011
Groups: None

Hey Pathe,

What Developer Preview are you using? DP4?

Also, is this the node.js client you're using?
https://github.com/elbart/node-memcache

I'll dig in deeper with that info.

Thanks,
Benjamin

Top
  • Login or register to post comments
Tue, 05/08/2012 - 05:24
Pathe
Offline
Joined: 04/23/2012
Groups: None

Hi Benjamin,

We're using DP4 with elbart's memcache lib, yes.

Right now, this is not required any more as we moved to a central development database instead of each dev having an instance running.

Anyway, this is the code:

app.get('/dbtest', function(req, res) {
  var view = {
    "_id": "_design/testdb",
    "views": {
      "index": {
        "map": "function (doc) {\n  if(doc.jsonType == \"user\") {\n    emit(doc._id, null);\n  }\n}"
      }
    }
  };
  client.connect();
  client.set('_design/testdb', JSON.stringify(view), function(error, result) {
    client.close();
    console.log(error, result);
  });
});

The document shows up as a regular document, but not in the views.

Patrick

Top
  • Login or register to post comments
Thu, 07/12/2012 - 08:16
jchrisa
Offline
Joined: 05/11/2011
Groups: None

Design docs must be updated via the REST API using PUT to /default/_design/foobam

If you are hitting the Admin UI port, you may need to prefix the path like this: /couchBase/default/_design/foobam

If written via the get/set API design documents will just be 'normal' data, so it's important to write them via REST to

Top
  • Login or register to post comments
Sun, 07/15/2012 - 13:55
ingenthr
Offline
Joined: 03/16/2010
Groups:

And, we're planning to add API for managing design documents to all of the official SDKs here shortly.

There's a Java example of how to do this without additional API that should be pretty easy for you to use in whatever language you need. See: http://www.couchbase.com/wiki/display/couchbase/Couchbase+Java+Client+Li...

Top
  • Login or register to post comments
Sat, 09/29/2012 - 05:47
Pathe
Offline
Joined: 04/23/2012
Groups: None

Mike,

I solved the problems in the node.js library called 'baseview' (https://github.com/PatrickHeneise/baseview). I still have to add the pool-request, but that's coming soon.

Patrick

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