couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Llewellyn <>
Subject Re: a newbie question about querying an exact array field
Date Wed, 21 Jul 2010 20:33:08 GMT
Thanks all for quick comments and heads up with javascript!  I was under the
dreamy impression that the array query value would be json encoded

I am storing values with simple keys but json lists and dicts and would like
to index these values by exposing them in a view, not as their individual
elements (I find the many 'tag' examples) but in their entirety.

>>You'll either have to json encode or hash the array and then compare
the hashes.

Ok that makes sense, but how do I query with a json encoded value?  I can
encode an array to json, and the arrays should be json already in the db,
but how would I write the query?

How do I do what I mean below?  Naively replacing my_array with a json
string eg "[1, 2, 3, 4, 5]" doesn't work.

eg doc.array = [1,2,3,4,5]

 if (doc.my_array == my_array in CLIENT ENCODED JSON)
{ emit(doc.my_array, doc);


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