You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2010/04/03 08:06:55 UTC
[Couchdb Wiki] Trivial Update of "EntityRelationship" by JanLehnardt
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.
The "EntityRelationship" page has been changed by JanLehnardt.
The comment on this change is: s/relation/relationship/.
http://wiki.apache.org/couchdb/EntityRelationship?action=diff&rev1=19&rev2=20
--------------------------------------------------
{{{
{
"_id":"some unique id",
- "type":"relation",
+ "type":"relationship",
"contact_id":"Scott",
"group_id":"Friends"
}
@@ -207, +207 @@
If you then want to know who is in a group you'll need to use the view (fetch descending to get the group info first)
{{{
"map":function(doc) {
- if (doc.type == 'relation') {
+ if (doc.type == 'relationship') {
emit(doc.group_id,doc.contact_id);
} else if (doc.type == 'group') {
emit(doc._id,doc);
@@ -218, +218 @@
To know what groups a contact belongs to you can use
{{{
"map":function(doc) {
- if (doc.type == 'relation') {
+ if (doc.type == 'relationship') {
emit([doc.contact_id,1],doc.group_id);
} else if (doc.type == 'contact') {
emit([doc._id,0],doc);