couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Trivial Update of "EntityRelationship" by JanLehnardt
Date Sat, 03 Apr 2010 06:06:55 GMT
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);

Mime
View raw message