flatiron/cradle — pull request #249 by dmitrymatveev (2014-05-14 04:47:35+00:00)
Title: 'db.view' function does not modify provided query options object anymore

db.view function modifies the passed-in options object which may lead to unexpected behaviour.

One case is when client code is using a reference to the same view options objects multiple times to query a view. This results in query options object differ from its original state yielding incorrect couchDB url string on consecutive calls to db.view function.

// E.g: stringifying params.key multiple times
var params = { key : 123 }
async.timesSeries( 5, function ( n, cb ) {
db.view( 'design/view', params, function () { cb();});
}, function () {
// params now equals to : {key: ""\"\\\"\\\\\\\"123\\\\\\\"\\\"\"""}
});