incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "paul jobs" <webjog...@gmail.com>
Subject Doing count of number of messages in inbox using couchdb map reduce
Date Thu, 18 Dec 2008 00:43:15 GMT
Please point out any mistakes in this approach

doc
<Row id='eef13abe4d9ced6defca304d956c6e58',
key='eef13abe4d9ced6defca304d956c6e58', value={'fromuid': 731179094,
'touid': 1073511011, 'created': '2008-12-16T18:07:03Z', '_rev':
'3348218151', 'replycount': 0, 'msg': 'u sexy', 'reply': None, '_id':
'eef13abe4d9ced6defca304d956c6e58', 'type': None, 'subject': 'how ru
doing'}>

map
function(doc) {  emit(doc.touid, 1) }

reduce
function(keys, values) { return sum(values)}

 for i in anondb.view('_view/truthbox/inboxcount',group=True):
    i
   ....:
   ....:
<Row key=515091294, value=1>
<Row key=518582324, value=1>
<Row key=532196519, value=1>
<Row key=532373444, value=1>
<Row key=601813842, value=1>
<Row key=609913339, value=1>
<Row key=614720525, value=1>
<Row key=636721052, value=1>
<Row key=686146326, value=2>
<Row key=706869488, value=14>
<Row key=717798794, value=1>
<Row key=718088951, value=1>
<Row key=731179094, value=14>
<Row key=745532697, value=9>
<Row key=900415470, value=1>
<Row key=1050876321, value=1>
<Row key=1068236284, value=1>
<Row key=1071620632, value=1>
<Row key=1072476232, value=1>
<Row key=1121661054, value=1>
<Row key=1172596643, value=1>
<Row key=1203429728, value=1>
<Row key=1244712151, value=1>
<Row key=1250229089, value=1>
<Row key=1268327796, value=1>
<Row key=1311018404, value=1>
<Row key=1340916503, value=2>
<Row key=1426542138, value=1>
<Row key=1432823487, value=1>
<Row key=1492661717, value=1>
<Row key=1563677715, value=1>
<Row key=1628382420, value=1>

How do we now get the inbox count for a particular user

anondb.view('_view/truthbox/inboxcount',group=True,key="731179094")
doesnt work?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message