if I wanted to use couchdb’s built in mapreduce view functionality, i.e. query a couchdb design document (view), it looks as though this is not supported by ember-couch (which is using pouchdb-find, which does not look like it wants to do this).
Would this mean writing my own Service? Or over-riding an Adapter to pretend the view’s answer is an ember model?
If this were the right way, then what tool is best for talking with couchdb through http from within ember? It looks like jquery is possible, is there a best way of using that tool within Ember objects / code? Is there any project out there on git that is already doing all of this?
There’s no special requirements for what kinds of data Ember can render. My suggestion is to start with a route’s model hook and just load the data however you want.
model() {
// using jQuery
return $.ajax('/your-couchdb-view');
}
model(){
// using fetch
return fetch('/your-couchdb-view');
}
Whatever data comes back for that URL is now the model for your route.
If later you decide you want more sophisticated caching or subscriptions or something like that, you can always add a Service to hold that long-lived state. And then if your Service starts to look like it’s reimplementing things Ember Data already does, then you can move your data loading into an Adapter.