# How to read records from couchdb view

**URL:** <https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762>\
**Category:** REST API\
**Created:** [November 12, 2015, 5:29pm UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762 "2015-11-12T17:29:43Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kfir\_Peled](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@Kfir\_Peled](https://community.dreamfactory.com/u/Kfir_Peled)\
**Post date:** [November 12, 2015, 5:29pm UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/1 "2015-11-12T17:29:43Z")

</div>

I’m trying without success to get my documents from my couchdb view I’ve created.  
Its works when I’m accessing the view through couchdb itself: \_design/{myDesign}/\_view/{viewName}

But I cant get the same with dreamfactory

/\_table/{tableName}/\_design/{myDesign}/\_view/{viewName}

please help me 😄  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![jeffreystables](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jeffreystables/32/173_2.png) [@jeffreystables](https://community.dreamfactory.com/u/jeffreystables)\
**Post date:** [November 12, 2015, 5:53pm UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/2 "2015-11-12T17:53:42Z")

</div>

Are CouchDB views similar to SQL views? Because DreamFactory treats SQL views as tables, essentially.

[https://wiki.dreamfactory.com/DreamFactory/Tutorials/Querying\_SQL\_views](https://wiki.dreamfactory.com/DreamFactory/Tutorials/Querying_SQL_views)

---

<div class="post-metadata">

**Author:** ![kimpatro](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/kimpatro/32/467_2.png) [@kimpatro](https://community.dreamfactory.com/u/kimpatro)\
**Post date:** [November 12, 2015, 6:39pm UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/3 "2015-11-12T18:39:06Z")

</div>

What is happening? Error? Invalid data? No data found?  
Give us more information about the problem.

---

<div class="post-metadata">

**Author:** ![Kfir\_Peled](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@Kfir\_Peled](https://community.dreamfactory.com/u/Kfir_Peled)\
**Post date:** [November 13, 2015, 8:53am UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/4 "2015-11-13T08:53:21Z")

</div>

I just don’t know and I didn’t find in the documentation any way to do that…

I know how to do it through couchdb… but not through dreamfactory

for example:  
[https://couchdb.com/newsfeed/\_design/ordered/\_view/byTime?limit=10&skip=0&descending=true](https://couchdb.com/newsfeed/_design/ordered/_view/byTime?limit=10&skip=0&descending=true)

ordered is my design document  
byTime is my view name

I tried to do the following:  
[https://df.enterprise.dreamfactory.com/api/v2/couch/\_table/newsfeed?filter=\_id=\_design/ordered&api\_key=\*\*\*](https://df.enterprise.dreamfactory.com/api/v2/couch/_table/newsfeed?filter=_id=_design/ordered&api_key=***)

but it says ‘SQL-like filters are not currently available for CouchDB’

---

<div class="post-metadata">

**Author:** ![kimpatro](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/kimpatro/32/467_2.png) [@kimpatro](https://community.dreamfactory.com/u/kimpatro)\
**Post date:** [November 13, 2015, 10:16am UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/5 "2015-11-13T10:16:58Z")

</div>

It seems that some SQL are not avaiable to couchdb, like “filters” (I know, pretty obvious).

Did you try to do a Service that don’t need any filter or SQL, to show all record, just for test.  
For example:  
[https://df.enterprise.dreamfactory.com/api/v2/couch/\_table/newsfeed?api\_key=\*\*](https://df.enterprise.dreamfactory.com/api/v2/couch/_table/newsfeed?api_key=**)

This route will show all feeds.

I’d talk about Custom Script, but it would be the same.

---

<div class="post-metadata">

**Author:** ![jeffreystables](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jeffreystables/32/173_2.png) [@jeffreystables](https://community.dreamfactory.com/u/jeffreystables)\
**Post date:** [November 13, 2015, 1:54pm UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/6 "2015-11-13T13:54:08Z")

</div>

That’s correct, SQL-like filters are not available for CouchDB. How familiar are you with CouchDB? This DB implements a query language in documents called views. So we didn’t attempt to implement SQL queries for CouchDB since Apache did it their own way in-house.

[Tutorial on CouchDB views](http://guide.couchdb.org/draft/views.html)  
[Apache documentation on views](https://wiki.apache.org/couchdb/Introduction_to_CouchDB_views)

Search the forums also. This was already covered in [this thread](https://community.dreamfactory.com/t/no-couchdb-filter-parameter/1287?u=jeffreystables).

---

<div class="post-metadata">

**Author:** ![Kfir\_Peled](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@Kfir\_Peled](https://community.dreamfactory.com/u/Kfir_Peled)\
**Post date:** [November 15, 2015, 7:41am UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/7 "2015-11-15T07:41:55Z")

</div>

Yes I can get all the records from df without any problem and yes I’m familiar with couchdb views…  
Do you have an example how to fetch from a view using dreamfactory?  
I didn’t find any on the web…

---

<div class="post-metadata">

**Author:** ![Kfir\_Peled](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@Kfir\_Peled](https://community.dreamfactory.com/u/Kfir_Peled)\
**Post date:** [November 18, 2015, 2:01pm UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/8 "2015-11-18T14:01:30Z")

</div>

any ideas?

* * *

---

<div class="post-metadata">

**Author:** ![Kfir\_Peled](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@Kfir\_Peled](https://community.dreamfactory.com/u/Kfir_Peled)\
**Post date:** [December 2, 2015, 7:43am UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/9 "2015-12-02T07:43:15Z")

</div>

Someone please can help me with this???

---

<div class="post-metadata">

**Author:** ![juniorconte](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/juniorconte/32/1007_2.png) [@juniorconte](https://community.dreamfactory.com/u/juniorconte)\
**Post date:** [December 2, 2015, 1:18pm UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/10 "2015-12-02T13:18:29Z")

</div>

Hello @Kfir_Peled, I also could not use the service couchdb, but did the following. As CouchDB natively exposes an API, I created a service type webservice in my DF.

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/4424dc6c823a30fb22ccaf6c8cf73b6a5fa74458.jpg)

_Note: My couch does not have authentication, but if you have, added it to the headers tab._

In my case, optimizers is my database  
I have a view called “resume” that is grouped in the “example” design

![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/0810831cdd68f2c8717ecc29e2e5d03485562628.jpg)

And for this scenario, my request to DF API is as follows:

[http://192.168.254.251/rest/couch-api/\_design/example/\_view/resume?limit=10&app\_name=my-api-key](http://192.168.254.251/rest/couch-api/_design/example/_view/resume?limit=10&app_name=my-api-key)

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/e8d6d83315421c442a4bfc5e20c7f5467a73b757.jpg)

_Note: My DF is 1.9, and in DF 2, it is very similar_

Best regards

---

<div class="post-metadata">

**Author:** ![Kfir\_Peled](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@Kfir\_Peled](https://community.dreamfactory.com/u/Kfir_Peled)\
**Post date:** [December 8, 2015, 9:14am UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/11 "2015-12-08T09:14:43Z")

</div>

Thanks for your response !!!

I’m using DF2 and in my case I get the following error:

message: "Resource ‘\_design’ not found for service ‘couch’."  
code: 404

with a big stack of DF code

---

<div class="post-metadata">

**Author:** ![kimpatro](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/kimpatro/32/467_2.png) [@kimpatro](https://community.dreamfactory.com/u/kimpatro)\
**Post date:** [December 8, 2015, 11:18am UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/12 "2015-12-08T11:18:42Z")

</div>

Maybe in DF2 they abstract that, try to call directly the resource:

`http://192.168.254.251/rest/couch-api/resume?limit=10&app_name=my-api-key`

or even with design in it:

`http://192.168.254.251/rest/couch-api/example/resume?limit=10&app_name=my-api-key`

Just a guess (a big one).

---

<div class="post-metadata">

**Author:** ![juniorconte](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/juniorconte/32/1007_2.png) [@juniorconte](https://community.dreamfactory.com/u/juniorconte)\
**Post date:** [December 10, 2015, 12:30am UTC](https://community.dreamfactory.com/t/how-to-read-records-from-couchdb-view/1762/13 "2015-12-10T00:30:49Z")

</div>

Hello, @Kfir_Peled

I could not make my couchdb work with api NoSQL. My solution was to set up the CouchDB in a webservice. Thus, the available resource are precisely what CouchDB offers natively via Rest API. The advantage is that with DF you can restrict the service to a role and use the user’s session without exposing directly to Rest native API of your CouchDB.

**1 - Create service type Webservice to connect native CouchDB Rest API**

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/07aeaa2abe6bfffe86179fabeb2f4d93b485efcd.jpg)

**2 - Configure CouchDB HTTP dsn in created Webservice**

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/b73f6a87f6f5849064490614c1b44f04d2f6b6b7.jpg)

**3 - Example of use with views and filters**

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/fbc41d07ee3476fc708f5461d0262e6d82331261.jpg)

Links:

Apache CouchDB Querying Options DOC: [https://goo.gl/4DJTTk](https://goo.gl/4DJTTk)  
DF2 API Common Headers & Parameters : [http://goo.gl/tPlnW9](http://goo.gl/tPlnW9)  
Postman (my API rest client tool used in this example): [https://www.getpostman.com](https://www.getpostman.com)

_I apologize if I was confused in my first response_

Best regards.
