Closed blainehansen closed 11 years ago
Hello, findMany
search documents by ids
. findMany
as a query with params, in couchdb this is view
.
Ah, you saying that makes me think the code is written backwards. Here's the return
for findMany
:
return this.ajax('_all_docs?include_docs=true', 'POST', normalizeResponce, { data: data });
and here's the return
for findAll
:
return this.ajax('_design/%@/_view/%@'.fmt(designDoc, typeViewName), 'GET', normalizeResponce, { data: data });
It seems to me those functionalities should be switched. findAll
should use the _all_docs?include_docs=true
and findMany
should use the _design/%@/_view/%@'.fmt(designDoc, typeViewName)
.
I'm saying this in the first place because in my code, return this.get('store').find('thing');
creates a 404 request because I don't have an all
view, and frankly, I shouldn't have to since I'm not doing anything fancy at this point.
lets see:
findMany: function(store, type, ids) {
We have ids as params from ember-data
when use relations.
findAll
- find all for type, this means GET request as http://server/things/index
In couchdb you can use view for type. In ember-couchdb-kit we name this view as all in typed design document.
Hm, then why isn't it working? I have this error thrown:
GET http://localhost/_couch/things/_design/thing/_view/all?include_docs=true&key=%22thing%22 404 (Object Not Found)
GET http://localhost/_couch/things/_design/thing/_view/all?include_docs=true&key=%22thing%22 404 You have 404 error from server. Create desing document step by step as http://wiki.apache.org/couchdb/HTTP_view_API#Creating_Views
In
findAll
ofdocument-adapter.js
, there is an assumption that users have an "all" _view. This is strange to me, sincefindMany
is implemented with the_all_docs?include_docs=true
addition, and it seemsfindAll
should do similarly, since it would be more robust and have out of the box support for any couch configuration.