You might have noticed the warning on the temporary view page that said the following:
Warning: Please note that temporary views that we'll create are not suitable for use in production and will respond much slower as your data increases. It's recommended that you use temporary views in experimentation and development, but switch to a permanent view before using them in an application.
Let's heed this warning and create a design document so that we can start to build this all into our application.
1. Open your browser to Futon.
2. Navigate to the temporary view page that we were working with: (
http://localhost:5984/_utils/database.html?verge/_temp_view
).3. Let's make our function a bit more useful, and change our key to
doc.user
.function(doc) { if (doc.type == 'post') { emit(doc.user, doc); } }
4. Click on Run to see the results.
5. Now that our view has the code that we want to use in our application, click on Save As... to save this view...