Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent 'db.view' function from modifying provided query options object. #249

Closed
wants to merge 1 commit into from

Conversation

dmitrymatveev
Copy link

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\\\\\\\"\\\"\"""} 
});

@dmitrymatveev dmitrymatveev changed the title 'db.view' function does not modify provided query options object anymore Prevent 'db.view' function from modifying provided query options object. May 14, 2014
@dmitrymatveev
Copy link
Author

apparently this is a fix for pull request #239 (how did I not see that when going over those just ten minutes ago)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant