couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matteo Caprari <>
Subject finding documents that fit a range and a list
Date Fri, 11 Dec 2009 14:01:56 GMT

I'm trying to find all documents that fit in a key range and that have
a property that is included in a list,
something in SQL would be

date > '2007-07-07' AND  date < '2008-08-08' AND tx IN ('transfer','purchase')

To do that I wrote a view and list
where the list and the map are

function(doc) {
    emit(, { tx: doc.tx, });

function(head, req) {
	var filter = req.query.filter.split(',');
	while(row = getRow()) {
		if (filter.indexOf(row.value.tx) != -1) {
and execute the query with I'm

Does this make any sense?
Is it a good idea to use _lists for stuff like this?
Are there better ways to do that?

:Matteo Caprari

View raw message