0

I am new to php so, need any help for this issue

I tried to run query

localhost/ls-test/_design/app-views/_view/timestamp-measurement?descending=true&include_docs=true

and get json return something like this format:

{"total_rows":441740,"offset":0,"rows":[
{"id":"123","key":[2013,2],"value":["1","PowerConsumption","0.0"],"doc":{"_id":"5446691910660799","SourceType":"SENSOR","SourceId":"4294403072","Property":"PowerConsumption","value":"0.0","}},
{"id":"124","key":[2013,2],"value":["228224","Motion","false"],"doc":{"_id":"5446688472521031","SourceType":"SENSOR","SourceId":"228224","Property":"Motion","value":"false","timestamp":"2013-02-12 17:06:06.768"}}
...]}

so, how do I further query it in PHP that my result only displayed based on specific value e.g only list of documents with SourceId:228224

2
  • I do not want to make a new view in couchdb since my couchdb database contains hundred thousands of documents already and adding more view only burden the server. so I would rather use php syntax to manipulate one view. Commented Feb 12, 2013 at 16:45
  • You'd rather get back more than 440 thousand rows than create a new view? That is burdening the server, to say the least. Creating a new view is the right way to go for your search given what you've shown. Commented Feb 12, 2013 at 17:32

1 Answer 1

1

You would json_decode in PHP then work with your associative array.

http://php.net/manual/en/function.json-decode.php

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.