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

$cb ->view still not working in couchbase 2.0 beta and php client?

3 replies [Last post]
  • Login or register to post comments
Wed, 09/26/2012 - 14:17
dunkspot
Offline
Joined: 05/29/2012
Groups: None

I had this problem with views with the developer-previews and on testing today with beta release , I realized the problems are there, using the example:

<?php
$cb = new Couchbase("127.0.0.1:8091", "beer-sample", "", "beer-sample");
$result = $cb->view("dev_beer", "beer_by_name");
foreach($result["rows"] as $row) {
echo $row->key;
}

I still could not retrieve any data. anyone succeeded ?

Top
  • Login or register to post comments
Sat, 09/29/2012 - 09:07
ingenthr
Offline
Joined: 03/16/2010
Groups:

The default query value for stale on views is update-after, meaning your first view request would trigger an update to the index but not return data, while the second one would. Did you try running that code sample twice?

Also, does the view work fine in the web console?

Top
  • Login or register to post comments
Sat, 09/29/2012 - 20:46
dunkspot
Offline
Joined: 05/29/2012
Groups: None

Problem solved ,
It wasn't a problem with the php client but with the example php code as below:
$cb = new Couchbase("127.0.0.1:8091", "default", "", "default");
$cb->set("a", 1);
$result = $cb->view("design_doc","my_view");
foreach($result["rows"] as $row) {
echo $row->key;
}

haha the last line of code is suppose to be
echo $row["key"];
since the results are arrays.

Top
  • Login or register to post comments
Mon, 10/01/2012 - 03:34
daschl
Offline
Joined: 05/19/2012
Groups: None

Correct, that's because we parse the JSON string into an array and not into stdObjects (this is a flag you can set on json_decode).

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