- Clone the repository and cd to this directory
- Edit the config-example file so that it contains your username, password, and database name.
- Create a new database using the name from step 2.
- Ensure the secondary indexes and search indexes listed below are created.
- mv config-example config
- ./deploy
- Point your browser to https://$user:$pass@$user.cloudant.com/$db/doc/songblog.html with $user, $pass, and $db replaced with the values from your config file.
function(doc) {
if(doc.type == "user")
emit(doc.birthday, doc._id);
}
function(doc) {
if(doc.type == "playlist"){
emit([doc._id, "playlist"], doc);
}
if(doc.type == "addsong"){
emit([doc.playlist, "song"], {"artist": doc.artist, "song": doc.song});
}
}
function(doc) {
if(doc.type == "playlist") {
emit([doc._id, 0], doc);
}
if(doc.type == "action" && doc.actiontype == "like") {
emit([doc.playlist, 1], doc);
}
if(doc.type == "action" && doc.actiontype == "comment") {
emit([doc.playlist, 2], doc);
}
}
function(doc){
if (doc.type)
index("type", doc.type);
}
function(doc){
if(doc.type == "addsong"){
index("artist", doc.artist);
index("song", doc.song);
}
if(doc.type == "action" && doc.actiontype == "comment"){
index("comment", doc.comment);
}
}
function(doc){
if(doc.type == "user")
index("default", doc._id);
}