Created
March 1, 2010 17:12
-
-
Save davidcoallier/318571 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/models/SphereView.php b/models/SphereView.php | |
index 5e778d2..f7b8b26 100644 | |
--- a/models/SphereView.php | |
+++ b/models/SphereView.php | |
@@ -13,14 +13,14 @@ class SphereView extends \lithium\data\Model { | |
'views' => array( | |
'posts' => array( | |
'map' => 'function(doc) { | |
- if (doc.type == "post") { | |
+ if (doc.type && doc.type == "post" && doc.created) { | |
emit(doc.created, doc); | |
} | |
}' | |
), | |
'users' => array( | |
'map' => 'function(doc) { | |
- if (doc.type == "user") { | |
+ if (doc.type && doc.type == "user" && doc.created) { | |
emit(doc.created, doc); | |
} | |
}' | |
@@ -32,8 +32,8 @@ class SphereView extends \lithium\data\Model { | |
'language' => 'javascript', | |
'views' => array( | |
'by_username' => array( | |
- 'map' => 'function(doc) { | |
- if(doc.type == "user") { | |
+ 'map' => 'function(doc) { | |
+ if(doc.type && doc.type == "user" && doc.username) { | |
emit(doc.username, doc); | |
} | |
}' | |
@@ -50,4 +50,4 @@ class SphereView extends \lithium\data\Model { | |
} | |
} | |
-?> | |
\ No newline at end of file | |
+?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment