coffeescript - CouchDB complex keys problems - only first two part of array are taken for the range -


somethings wrong couchdb complex query processing.

i have map function emits complex key consisted of 6 params this:

emit([doc.profileid,  doc.beamid, doc.name, doc.beambeanchid, "true", attachname], {beamdocid:doc._id, attachname:attachname}) 

my query parameters (coffescript) this:

params = startkey:[ profileid, beamid, nameprefix, beambeanchid, hasattach, attachnameprefix] endkey:[   profileid or "\ufff0",   beamid or "\ufff0",   nameprefixend or "\ufff0",   beambeanchid or "\ufff0",   hasattachend,   attachnameprefixend or "\ufff0"] 

the problem 2 first working properly, rest not filtering @ all. instance when set nameprefixend value not null it's not reducing result.

i tried keys emmited objects , arrays. same story, first 2 working. third ignored. when change order instance beamid nameprefixend still first 2 working properly.

any ideas what's wrong? there limits on number of parameters in couchdb complex keys?

i'm using nano library access data , db.view function.

ok. found answer myself. in general structure of key in startkey/endkey must exact match emited keys.

to solve case need emit possible combination of fields i'll looking later.

for instance:

emit([doc.profileid,  doc.beamid, doc.name, doc.beambeanchid, "true", attachname],      {beamdocid:doc._id, attachname:attachname}) emit([doc.profileid,  doc.name, doc.beambeanchid, "true", attachname],      {beamdocid:doc._id, attachname:attachname}) emit([doc.profileid,  doc.name, doc.beambeanchid, "true", attachname],      {beamdocid:doc._id, attachname:attachname}) emit([doc.profileid,  doc.beambeanchid, "true", attachname],      {beamdocid:doc._id, attachname:attachname}) emit([doc.profileid, attachname],      {beamdocid:doc._id, attachname:attachname}) 

etc. can find need. of course make bullet proof it's better use object keys instead array, otherwise value might mixed up.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -