Permalink
Browse files

follow stuff

  • Loading branch information...
1 parent 226d71b commit 908cceb1755fa6b575ba438ecc9f552d36dbb2ab @mamund mamund committed Jul 23, 2011
Showing with 27 additions and 8 deletions.
  1. +8 −0 2011-07-21-notes.txt
  2. +1 −0 README
  3. +11 −5 design-doc.json
  4. +7 −3 microblog_data.sh
View
@@ -7,15 +7,23 @@ posts
*** views ***
messages-all
+
messages-me
messages-friends
messages-mentions
messages-shares (???)
messages-replies (???)
+
messages-search
+startkey="ab"&endkey="ab\u9999"
users-all
+
users-me (single record)
+key="mamund"
+
users-friends (i follow these)
users-followers (they follow me)
+
users-search
+startkey="ab"&endkey="ab\u9999"
View
1 README
@@ -2,3 +2,4 @@
Design for HackDay Microblog challenge
+check out IrisCouch for free hosting
View
@@ -24,7 +24,14 @@
"posts_all" : {
"map" : "function(doc) {
if(doc._id && doc.type==='post') {
- emit(doc._id,doc);
+ emit(doc.dateCreated.split('-'),doc);
+ }
+ }"
+ },
+ "posts_by_user" : {
+ "map" : "function(doc) {
+ if(doc._id && doc.type==='post') {
+ emit(doc.user, doc);
}
}"
},
@@ -39,17 +46,17 @@
"follows_user_is_following" : {
"map" : "function(doc) {
if(doc.user && doc.type==='follow') {
- emit(doc.user, doc.follows);
+ emit(doc.user, {_id:doc.follows});
}
}"
},
"follows_is_following_user" : {
"map" : "function(doc) {
if(doc.follows && doc.type==='follow') {
- emit(doc.follows, doc.user);
+ emit(doc.follows, {_id:doc.user});
}
}"
- },
+ }
},
"validate_doc_update": "function(newDoc, oldDoc, userCtx) {
@@ -90,4 +97,3 @@
}
}"
}
-
View
@@ -15,6 +15,7 @@ curl -vX PUT http://localhost:5984/html5-microblog/_design/microblog -d @design-
echo 'adding users...'
curl -vX PUT http://localhost:5984/html5-microblog/mamund -d @user-mamund.json
curl -vX PUT http://localhost:5984/html5-microblog/lee -d @user-lee.json
+curl -vX PUT http://localhost:5984/html5-microblog/lee -d @user-benjamin.json
echo 'testing user views...'
curl -v http://localhost:5984/html5-microblog/_design/microblog/_view/users_all
@@ -24,16 +25,19 @@ echo 'adding posts...'
curl -vX POST http://localhost:5984/html5-microblog/ -d @post1-mamund.json
curl -vX POST http://localhost:5984/html5-microblog/ -d @post2-mamund.json
curl -vX POST http://localhost:5984/html5-microblog/ -d @post1-lee.json
+curl -vX POST http://localhost:5984/html5-microblog/ -d @benjamin-post1.json
echo 'testing post views...'
curl -v http://localhost:5984/html5-microblog/_design/microblog/_view/posts_all
curl -v http://localhost:5984/html5-microblog/_design/microblog/_view/posts_by_user?key=\"mamund\"
echo 'adding follows...'
curl -vX POST http://localhost:5984/html5-microblog/ -d @follows-mamund.json
-#curl -vX POST http://localhost:5984/html5-microblog/ -d @follows-lee.json
+curl -vX POST http://localhost:5984/html5-microblog/ -d @follows-lee.json
+curl -vX POST http://localhost:5984/html5-microblog/ -d @follows-benjamin.json
+curl -vX POST http://localhost:5984/html5-microblog/ -d @follows-mamund2.json
echo 'testing follow views...'
-curl -v http://localhost:5984/html5-microblog/_design/microblog/_view/follows_user_is_following?key=\"mamund\"
-curl -v http://localhost:5984/html5-microblog/_design/microblog/_view/follows_is_following_user?key=\"mamund\"
+curl -v http://localhost:5984/html5-microblog/_design/microblog/_view/follows_user_is_following?include_docs=true&key=\"mamund\"
+curl -v http://localhost:5984/html5-microblog/_design/microblog/_view/follows_is_following_user?include_docs=true&key=\"mamund\"

0 comments on commit 908cceb

Please sign in to comment.