{"action":"created","issue":{"url":"https://api.github.com/repos/marklogic/node-client-api/issues/219","labels_url":"https://api.github.com/repos/marklogic/node-client-api/issues/219/labels{/name}","comments_url":"https://api.github.com/repos/marklogic/node-client-api/issues/219/comments","events_url":"https://api.github.com/repos/marklogic/node-client-api/issues/219/events","html_url":"https://github.com/marklogic/node-client-api/issues/219","id":115759030,"number":219,"title":"query result read stream does not end","user":{"login":"csreddy","id":1539198,"avatar_url":"https://avatars.githubusercontent.com/u/1539198?v=3","gravatar_id":"","url":"https://api.github.com/users/csreddy","html_url":"https://github.com/csreddy","followers_url":"https://api.github.com/users/csreddy/followers","following_url":"https://api.github.com/users/csreddy/following{/other_user}","gists_url":"https://api.github.com/users/csreddy/gists{/gist_id}","starred_url":"https://api.github.com/users/csreddy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csreddy/subscriptions","organizations_url":"https://api.github.com/users/csreddy/orgs","repos_url":"https://api.github.com/users/csreddy/repos","events_url":"https://api.github.com/users/csreddy/events{/privacy}","received_events_url":"https://api.github.com/users/csreddy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"csreddy","id":1539198,"avatar_url":"https://avatars.githubusercontent.com/u/1539198?v=3","gravatar_id":"","url":"https://api.github.com/users/csreddy","html_url":"https://github.com/csreddy","followers_url":"https://api.github.com/users/csreddy/followers","following_url":"https://api.github.com/users/csreddy/following{/other_user}","gists_url":"https://api.github.com/users/csreddy/gists{/gist_id}","starred_url":"https://api.github.com/users/csreddy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csreddy/subscriptions","organizations_url":"https://api.github.com/users/csreddy/orgs","repos_url":"https://api.github.com/users/csreddy/repos","events_url":"https://api.github.com/users/csreddy/events{/privacy}","received_events_url":"https://api.github.com/users/csreddy/received_events","type":"User","site_admin":false},"milestone":null,"comments":12,"created_at":"2015-11-08T20:48:51Z","updated_at":"2015-11-09T21:10:23Z","closed_at":"2015-11-09T21:10:23Z","body":"The query result stream seems to get stuck and never emits  `end` event. I can see all the documents being processed correctly in `data` callback but stream does not end. I have to retry couple of times to return results, sometimes it works in one try and sometime it takes couple of times. \r\n\r\nThe equivalent `.result()` version works just fine\r\n\r\ntried on latest official and on develop branch, same issues on both\r\n\r\n```javascript\r\ndb.documents.read({\r\n                    uris: uris, // array of 11 uris,\r\n                    transform: ['all-transforms'] // no issues with transforms script as i can see all documents in *data* callback\r\n                })\r\n              .stream()\r\n              .on('data', function(document) {\r\n                        var content = (!_.isObject(document.content)) ? JSON.parse(document.content) : document.content;\r\n                        if (!_.isNull(content) || content.length > 0) {\r\n                            diffsOnEachPlatform[content[0].platform.name] = _.pluck(content, 'name');\r\n                        }\r\n                    })\r\n              .on('error', function(error) {\r\n                        console.error(error);\r\n                    })\r\n              .on('end', function() {\r\n                      // control never gets here, it often takes multiple tries to work\r\n                        console.log(diffsOnEachPlatform);\r\n                    });\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/marklogic/node-client-api/issues/comments/155194386","html_url":"https://github.com/marklogic/node-client-api/issues/219#issuecomment-155194386","issue_url":"https://api.github.com/repos/marklogic/node-client-api/issues/219","id":155194386,"user":{"login":"csreddy","id":1539198,"avatar_url":"https://avatars.githubusercontent.com/u/1539198?v=3","gravatar_id":"","url":"https://api.github.com/users/csreddy","html_url":"https://github.com/csreddy","followers_url":"https://api.github.com/users/csreddy/followers","following_url":"https://api.github.com/users/csreddy/following{/other_user}","gists_url":"https://api.github.com/users/csreddy/gists{/gist_id}","starred_url":"https://api.github.com/users/csreddy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csreddy/subscriptions","organizations_url":"https://api.github.com/users/csreddy/orgs","repos_url":"https://api.github.com/users/csreddy/repos","events_url":"https://api.github.com/users/csreddy/events{/privacy}","received_events_url":"https://api.github.com/users/csreddy/received_events","type":"User","site_admin":false},"created_at":"2015-11-09T21:10:23Z","updated_at":"2015-11-09T21:10:23Z","body":"well, the request was timing out in my app too, not just in mocha. not sure what's wrong. Thanks for looking into it"}}