Posting database views from CouchApp
I am new to CouchDB and CouchApp and I am trying to make a couchapp that can be called on any couchdb database and present the user with the available fields so that he can choose one and get all the records for that field.
It would work kind of like this: One calls the app with something like
http://host:5984/couchapp_db/_design/couchapp_name/index.html?host=data_host:5984&db=data_db
This presents the user with the list of keys in the database. The user selects one and the app shows the values for that field.
That requires that there is a view that gets all fields in the database, I already solved that with the post "how could-i-determine-all-possible-keys-of-a-couchdb-database"
In order to get the values the user asks for, I would need a simple view like:
function(doc) {
if(doc.user_selected_field)
emit(null, doc.user_selected_field)
}
How can you check from the couch app if this view exists for the database and if it does not, how can you create it?
Maybe there is a pretty standard solution to this开发者_开发知识库, but I have not found it, and, as I mentioned, I am just starting with couchdb.
Couchapp may not be your best option for this. You can use CouchDB on multitudes of way more powerful platforms very easily, so why not consider something else?
CouchApp is a very simple platform for viewing your database, think of it like phpMyAdmin but like really customizable.
精彩评论