Hi,

I have documents(JSON) stored by a unique key we are using for all other 
functions, but there is a callback which is using a different key which is 
in the JSON-document.

So i create a view like this:

conn = Couchbase.connect(bucket='bucket', host='host')
t2 = {'views': {'t2': { 'map': "function (doc, meta) {\n  if(doc.msg_id == 
'3924723897487'){\n  emit(doc, null);\n  }\n}"}}}
conn.design_create('dev_t', t2)

when i go to the GUI i see the view and when i click show results i see 
what i wanted, but i dont know how to get the results in python:

print conn.query('dev_t', 't2')
View<Design=dev_t, View=t2, Query=Query:'', Rows Fetched=0>

using REST is ok but I would prefer to use the couchbase lib...

x = requests.get('http://test.domain.com:8092/TEST/_design/dev_t/_view/t2')
print x.content
{"total_rows":1,"rows":[ 
the-wanted-document
]
}

Thanks,
Peter

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to