CouchbaseViewQuery::from () ->custom ()


#1

Hello Brett.
I’m have View Code:

function (doc, meta) {
  if (meta.type == "json" && doc.title && doc.date) {
    // Check if doc is JSON
    emit(doc.date, doc.title);
  } else {
    // do something with binary value
  }
}

I’m trying to execute queries such as:

$query = CouchbaseViewQuery::from('article_by_date', 'article_by_date')->range("2013/01/01 00:00:00", "2014/12/31 23:59:59", true);

i’ts work.

Then i try:

$query = CouchbaseViewQuery::from('article_by_date', 'article_by_date')->custom(["2013/01/01 00:00:00" => "Header super article"]);

i’ts not work.

Documents like this:

{
   "id": "4eb373023a3316275f3e3f2e8b018134",
   "type": "article",
   "article": "Test super article",
   "date": "2014/5/26 0:49:1",
   "year": "2014",
   "mounth": "12",
   "day": "17",

#2

solve
$query = CouchbaseViewQuery::from(‘article_by_date’, ‘article_by_date’)->key(“2013/7/23 14:39:21”, “Header super article”);