{"action":"closed","issue":{"url":"https://api.github.com/repos/NIFTYCloud-mbaas/UserCommunity/issues/231","repository_url":"https://api.github.com/repos/NIFTYCloud-mbaas/UserCommunity","labels_url":"https://api.github.com/repos/NIFTYCloud-mbaas/UserCommunity/issues/231/labels{/name}","comments_url":"https://api.github.com/repos/NIFTYCloud-mbaas/UserCommunity/issues/231/comments","events_url":"https://api.github.com/repos/NIFTYCloud-mbaas/UserCommunity/issues/231/events","html_url":"https://github.com/NIFTYCloud-mbaas/UserCommunity/issues/231","id":103965057,"number":231,"title":"【javascript】オブジェクトの大量削除(100件以上)について","user":{"login":"iseki0225","id":8037200,"avatar_url":"https://avatars.githubusercontent.com/u/8037200?v=3","gravatar_id":"","url":"https://api.github.com/users/iseki0225","html_url":"https://github.com/iseki0225","followers_url":"https://api.github.com/users/iseki0225/followers","following_url":"https://api.github.com/users/iseki0225/following{/other_user}","gists_url":"https://api.github.com/users/iseki0225/gists{/gist_id}","starred_url":"https://api.github.com/users/iseki0225/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iseki0225/subscriptions","organizations_url":"https://api.github.com/users/iseki0225/orgs","repos_url":"https://api.github.com/users/iseki0225/repos","events_url":"https://api.github.com/users/iseki0225/events{/privacy}","received_events_url":"https://api.github.com/users/iseki0225/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NIFTYCloud-mbaas/UserCommunity/labels/%E3%83%87%E3%83%BC%E3%82%BF%E3%82%B9%E3%83%88%E3%82%A2","name":"データストア","color":"159818"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-31T00:21:40Z","updated_at":"2016-02-08T08:21:13Z","closed_at":"2016-02-08T08:21:13Z","body":"お世話になります。\r\n現在、mbaasを利用し、集計ロジックを作成しております。\r\n新しい集計結果の保存後に、古い集計結果を削除したいので、以下のようなロジックを作成しました。\r\nデータが少量の時は問題なかったのですが、データ数が100件を超えたくらいから、削除が上手く出来ません。\r\n\r\n\r\n```\r\n//引数のkeyは集計タイミングの判別Keyとなります。\r\nfunction removeModel(key){\r\n  var query = makeNcmbObject(\"TestClass\")['query'];\r\n  query.notEqualTo(\"key\", key);\r\n  query.limit(100);\r\n  query.skip(0);\r\n\tquery.find({\r\n\t\tsuccess: function(results) {\r\n\t\t\tif(results.length === 0){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tfor (var i=0; i < result.length; i++){\r\n\t\t\t\tvar obj = results[i];\r\n\t\t    \tobj.destroy();\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(error){\r\n\t\t\tconsole.log(error);\r\n\t\t\treturn;\r\n\t\t}\r\n\t});\r\n```\r\n\t\r\n個人的な推察ですが、同時接続上限のエラーに引っかかっていると考えています。\r\n以下、ご回答いただけますと幸いです。\r\n\r\n1)エラーが発生する原因は他に何かありますでしょうか？\r\n\r\n2)保存については、NCMB.Object.saveAllがありますが、destroyについてはそれに相当するものはないのでしょうか？\r\n\r\n3)(2)がない場合は、何かよいロジックはありませんでしょうか？\r\n\r\n以上、よろしくお願いいたします。"}}