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

PHP - how to create View from script

1 reply [Last post]
  • Login or register to post comments
Thu, 02/14/2013 - 16:34
OZ
Offline
Joined: 01/18/2013
Groups: None

Is it possible to create view from PHP script?
How?

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

Yes it is possible. We have not documented the feature (but it will come soon see http://www.couchbase.com/issues/browse/PCBC-172 )

The code to achieve that is the following :

...
$name = "dev_myView";
$map = '{"views":{"myview":{"map":"function (doc, meta) { emit(meta.id, NULL); }"}}}';
$ret = $cb->setDesignDoc($name, $map);
 
...

If you need more information you can look at the test cases:
- https://github.com/couchbase/php-ext-couchbase/blob/master/tests/DesignD...
- https://github.com/couchbase/php-ext-couchbase/blob/master/tests/ViewBas...

regards

__________________

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