couchdb-conduit-0.10.0: Couch DB client library using http-conduit and aeson

Safe HaskellSafe-Infered




CouchDB View Query options.

For details see Note, because all options must be a proper URL encoded JSON, construction of complex parameters can be very tedious. To simplify this, use mkQuery.


Creating Query

data CouchQP Source

CouchDB Query options primitives.


forall a . ToJSON a => QPComplex ByteString a

Complex view query parameter.

 couchQP [QPComplex "param" (["a", "b"] :: [String])]
 [("param", Just "[\"a\",\"b\"]")]
 couchQP [QPComplex "key" (("a", 1) :: (String, Int))]
 [("key", Just "[\"a\",0]")]

It't just convert lazy ByteString from encode to strict ByteString. For more efficient use specific functions.

QPBS ByteString ByteString

Quoted ByteString query parameter.

QPInt ByteString Int

Int query parameter.

QPBool ByteString Bool

Bool query parameter.

QPLimit Int

Limit rows. Use Zero (0) to omit.

QPSkip Int

Skip rows. Use Zero (0) to omit.

QPStale Bool

Stale view. On True sets stale parameter to ok, else sets it to update_after.

forall a . ToJSON a => QPKey a 
forall a . ToJSON a => QPStartKey a

Row key to start with. Becomes endkey if descending turned on. See couchQuery.

forall a . ToJSON a => QPEndKey a

Row key to start with. Becomes startkey if descending turned on. See couchQuery.

forall a . ToJSON a => QPKeys a

Row key to start with. Use only with couchView and couchView_. For large sets of keys use couchViewPost and couchViewPost_


Turn on grouping.

QPGroupLevel Int

Set grouping level. Use Zero (0) to omit.

QPReduce Bool

Control reduce.


Turn on inclusion docs in view results.


Turn off inclusion endkey in view results.


Response includes an update_seq value indicating which sequence id of the database the view reflects

QPStartKeyDocId Path

Document id to start with.

QPEndKeyDocId Path

Document id to end with.




:: Bool

Descending sort order. On True adds descending to query. Also swaps start_key and end_key parameters

-> [CouchQP]

Query options.

-> Query 

Make CouchDB query options.

Parameter helpers

qpUnit :: HashMap ByteString BoolSource

Returns empty HashMap. Aeson will convert this to {} (JSON unit). This useful for startkey and endkey.

 couchQuery [QPStartKey (1, 0), QPEndKey (1, {})]

qpNull :: ValueSource

Simply return Null.