{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-js/issues/1187","repository_url":"https://api.github.com/repos/aws/aws-sdk-js","labels_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/1187/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/1187/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/1187/events","html_url":"https://github.com/aws/aws-sdk-js/issues/1187","id":183073355,"number":1187,"title":"AWS.DynamoDB scan vs AWS.DynamoDB.DocumentClient scan","user":{"login":"designreact","id":6464260,"avatar_url":"https://avatars.githubusercontent.com/u/6464260?v=3","gravatar_id":"","url":"https://api.github.com/users/designreact","html_url":"https://github.com/designreact","followers_url":"https://api.github.com/users/designreact/followers","following_url":"https://api.github.com/users/designreact/following{/other_user}","gists_url":"https://api.github.com/users/designreact/gists{/gist_id}","starred_url":"https://api.github.com/users/designreact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/designreact/subscriptions","organizations_url":"https://api.github.com/users/designreact/orgs","repos_url":"https://api.github.com/users/designreact/repos","events_url":"https://api.github.com/users/designreact/events{/privacy}","received_events_url":"https://api.github.com/users/designreact/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aws/aws-sdk-js/labels/Feedback%20Requested","name":"Feedback Requested","color":"e102d8"},{"url":"https://api.github.com/repos/aws/aws-sdk-js/labels/Question","name":"Question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-10-14T15:02:11Z","updated_at":"2016-10-19T12:42:34Z","closed_at":null,"body":"I am experiencing an issue whereby using DocumentClient scan returns less results than when using DynamoDB scan directly.\r\n\r\nGiven the below code. When replacing docClient with dynamodb I get 150 extra entries, as far as I am aware both docClient.scan() and dynamodb.scan() should return the same number of results.\r\n\r\nIs this a bug or likely to be something in my data set? Any insight would be great.\r\n(\"aws-sdk\": \"^2.6.9\")\r\n\r\n\r\n```\r\nconst dynamodb = new AWS.DynamoDB({\r\n  apiVersion: '2012-08-10',\r\n  endpoint: config.databaseServer\r\n})\r\nconst docClient = new AWS.DynamoDB.DocumentClient()\r\n\r\nconst tableName = 'MyTable'\r\n\r\ndoScan(query, resultSet, lastEvaluatedKey, callBack) {\r\n    const params = Object.assign({}, query, { TableName: tableName, ExclusiveStartKey: lastEvaluatedKey, Limit: 100 })\r\n    docClient.scan(params, (err, data) => {\r\n      if (err) {\r\n        console.log(err)\r\n        callBack(`Unable to query. Error JSON: ${JSON.stringify(err)}`)\r\n      } else {\r\n        const set = resultSet.concat(data.Items)\r\n        if (typeof data.LastEvaluatedKey !== 'undefined') {\r\n          this.doScan(query, set, data.LastEvaluatedKey, callBack)\r\n        } else {\r\n          callBack(null, set)\r\n        }\r\n      }\r\n    })\r\n  }\r\n  getScan(query) {\r\n    return new Promise((resolve, reject) => {\r\n      const resultSet = []\r\n      const lastEvaluatedKey = null\r\n      this.doScan(query, resultSet, lastEvaluatedKey, (err, data) => {\r\n        if (err) {\r\n          console.log(err)\r\n          reject(`Unable to query. Error JSON: ${JSON.stringify(err)}`)\r\n        } else {\r\n          resolve(data)\r\n        }\r\n      })\r\n    })\r\n  }\r\n\r\n... \r\n\r\ngetScan({})\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/aws/aws-sdk-js/issues/comments/254800830","html_url":"https://github.com/aws/aws-sdk-js/issues/1187#issuecomment-254800830","issue_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/1187","id":254800830,"user":{"login":"designreact","id":6464260,"avatar_url":"https://avatars.githubusercontent.com/u/6464260?v=3","gravatar_id":"","url":"https://api.github.com/users/designreact","html_url":"https://github.com/designreact","followers_url":"https://api.github.com/users/designreact/followers","following_url":"https://api.github.com/users/designreact/following{/other_user}","gists_url":"https://api.github.com/users/designreact/gists{/gist_id}","starred_url":"https://api.github.com/users/designreact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/designreact/subscriptions","organizations_url":"https://api.github.com/users/designreact/orgs","repos_url":"https://api.github.com/users/designreact/repos","events_url":"https://api.github.com/users/designreact/events{/privacy}","received_events_url":"https://api.github.com/users/designreact/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T12:42:33Z","updated_at":"2016-10-19T12:42:33Z","body":"Unfortunately I don't have the sample results to hand. It'll take me a day or two to find time but I'll put together a sample project, verify the bug is still present in the sample code and invite you to the repo.\r\n\r\nOnce I've done this - providing the bug is present will be able to see my implementation in action and verify the bug exists using the same code as I.\r\n\r\nApologies for the upcoming delay - I'm up against some pretty tight deadlines atm."}}
{"actor":{"display_login":"designreact"}}