couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <>
Subject Re: case-insensitive comparison inside js script for map/reduce
Date Tue, 30 Oct 2012 14:36:43 GMT

On Oct 29, 2012, at 11:46 PM, Pulkit Singhal <<>>

I was wondering if there are already utility methods present in CouchDB
1.2.0 that perform a case-insensitive comparison?

Not that I know of. You can do this by lowercasing each string and comparing them; or if one
of the strings is a constant, you can convert it to a regexp and do a case-insensitive match,
i.e. /foobar/i .

(In either case, you may have I18N problems, as most JS implementations seem to have limited
Unicode support and may not be able to do this kind of transliteration on non-Roman letters.
I’ve had trouble with this in client-side web scripts.)

Or you could just make sure you store normalized (e.g. lowercased) strings in your documents,
to avoid the necessity of case-insensitive comparison.


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