Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
In couchDB you have to plan for views beforehand. As you go along, data will grow and it would be a cumbersome task to change views and wait for data reindexing.

In order to implement a view in couchDB you write JS code. For writing view you have to at least have a map function (reduce can be ignored).

An example of a view to get users by their corresponding uid:

function(doc) {
if (doc.type == "user")
emit(doc.user_id, doc);
}

Here we pass doc which is database documents to our function and check if type of document is user (type field is added it is not related to couchDB view), we will emit (let's say return) user document. It's key is user_id and it's value will be user document.

#view #couchdb
Media is too big
VIEW IN TELEGRAM
Routes implementation in `Django` and how to wire routes & views

#python #django #route #view #django_part8