{"_id":"5735d3bca430ed22001c5e8c","category":{"_id":"5735a52431a73b1700887ca0","project":"54774d9af3736008009e9e0e","__v":0,"version":"56a0bd9e3697d80d002ac5e7","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-05-13T09:57:56.274Z","from_sync":false,"order":13,"slug":"data-objects","title":"Data Objects"},"parentDoc":null,"project":"54774d9af3736008009e9e0e","__v":14,"version":{"_id":"56a0bd9e3697d80d002ac5e7","project":"54774d9af3736008009e9e0e","__v":20,"createdAt":"2016-01-21T11:14:38.131Z","releaseDate":"2016-01-21T11:14:38.131Z","categories":["56a0bd9f3697d80d002ac5e8","56a0bd9f3697d80d002ac5e9","56a0bd9f3697d80d002ac5ea","56a0bd9f3697d80d002ac5eb","56b098a43a5b810d00745e3f","56b098da8f7a4f0d0029dd10","56d5a8ecf612b80b00fb69cd","570989853ab43c0e0072b2d6","571006aa10300c0e007f6133","5735a52431a73b1700887ca0","5744b0529e045c0e00b7a7a2","5744b1d0b56d431700d8a4fb","5744b1fb55d65a0e00b436e1","5744b218f9c7411700ce560e","5744b220f9c7411700ce560f","5744b2259e045c0e00b7a7a7","5744b22cf8b79f0e00de6a2d","5744b23155d65a0e00b436e4","5744b242c758290e00fbc235","5744b2569e045c0e00b7a7a8","5756a3f2bb92962900dafe3d","57ee23e81e42900e0014a42f","581c822c98676e0f00d240ef"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Sockets","version_clean":"1.1.0","version":"1.1"},"user":"54774c47f3736008009e9e0c","updates":["5758296972609e0e00523ff5"],"next":{"pages":[],"description":""},"createdAt":"2016-05-13T13:16:44.057Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Data Objects Count\"\n}\n[/block]\nYou can get the Data Objects count **estimation** when listing your objects. Syncano gives an exact count for Data Classes that have less than 1000 Data Objects and an estimate for Data Classes that have more than 1000 Data Objects.\n\nHere's how you can view the Data Objects count estimation:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# page_size set to zero to exclude any Data Objects from the response for clarity\\n\\ncurl -X GET -G \\\\\\n-H \\\"X-API-KEY: API_KEY\\\" \\\\\\n-d include_count=true \\\\\\n-d page_size=0 \\\\\\n\\\"https://api.syncano.io/v1.1/instances/INSTANCE_NAME/classes/DATA_CLASS_NAME/objects/\\\"\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"import syncano\\nfrom syncano.models.base import Class\\n\\nconnection = syncano.connect(api_key='API_KEY')\\nklass = Class.please.get(instance_name='INSTANCE_NAME', name='CLASS_NAME')\\nklass.objects.count()\\n                             \\n# or:\\n\\nObject.please.list(\\n  instance_name='INSTANCE_NAME', class_name=\\\"CLASS_NAME\\\").count()\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"var Syncano = require(\\\"syncano\\\");  // CommonJS\\nvar connection = Syncano({accountKey: \\\"ACCOUNT_KEY\\\"});\\nvar DataObject = connection.DataObject;\\n\\nvar query = {\\n  instanceName: \\\"INSTANCE_NAME\\\",\\n  className: \\\"CLASS_name\\\"\\n};\\n\\nDataObject.please().list(query).count().then(callback);\",\n      \"language\": \"javascript\"\n    },\n    {\n      \"code\": \"Response<Integer> response = Syncano.please(Book.class).getCountEstimation();\\nInteger count = response.getData();\",\n      \"language\": \"java\",\n      \"name\": \"Android\"\n    },\n    {\n      \"code\": \"SCPlease *please = [Book please];\\n[please giveMeDataObjectsWithParameters::::at:::{SCPleaseParameterIncludeCount : @(YES)} completion:^(NSArray *objects, NSError *error) {     \\n  NSNumber *objectsCount = please.objectsCount;\\n}];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"let please:SCPlease = Book.please()\\nplease.giveMeDataObjectsWithParameters([SCPleaseParameterIncludeCount : true]) { (objects, error) in\\n    let objectsCount:NSNumber = please.objectsCount\\n}\",\n      \"language\": \"objectivec\",\n      \"name\": \"Swift\"\n    },\n    {\n      \"code\": \"// NOT AVAILABLE\",\n      \"language\": \"csharp\",\n      \"name\": \"Unity\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"prev\\\":null,\\n  \\\"objects_count\\\":48843,\\n  \\\"objects\\\":[],\\n  \\\"next\\\":null\\n}\",\n      \"language\": \"json\"\n    },\n    {\n      \"code\": \"48837\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]","excerpt":"Syncano allows you to get a count estimation over 1k Data Objects in a specific Data Class","slug":"getting-data-objects-count","type":"basic","title":"Getting count estimation"}

Getting count estimation

Syncano allows you to get a count estimation over 1k Data Objects in a specific Data Class

[block:api-header] { "type": "basic", "title": "Data Objects Count" } [/block] You can get the Data Objects count **estimation** when listing your objects. Syncano gives an exact count for Data Classes that have less than 1000 Data Objects and an estimate for Data Classes that have more than 1000 Data Objects. Here's how you can view the Data Objects count estimation: [block:code] { "codes": [ { "code": "# page_size set to zero to exclude any Data Objects from the response for clarity\n\ncurl -X GET -G \\\n-H \"X-API-KEY: API_KEY\" \\\n-d include_count=true \\\n-d page_size=0 \\\n\"https://api.syncano.io/v1.1/instances/INSTANCE_NAME/classes/DATA_CLASS_NAME/objects/\"", "language": "curl" }, { "code": "import syncano\nfrom syncano.models.base import Class\n\nconnection = syncano.connect(api_key='API_KEY')\nklass = Class.please.get(instance_name='INSTANCE_NAME', name='CLASS_NAME')\nklass.objects.count()\n \n# or:\n\nObject.please.list(\n instance_name='INSTANCE_NAME', class_name=\"CLASS_NAME\").count()", "language": "python" }, { "code": "var Syncano = require(\"syncano\"); // CommonJS\nvar connection = Syncano({accountKey: \"ACCOUNT_KEY\"});\nvar DataObject = connection.DataObject;\n\nvar query = {\n instanceName: \"INSTANCE_NAME\",\n className: \"CLASS_name\"\n};\n\nDataObject.please().list(query).count().then(callback);", "language": "javascript" }, { "code": "Response<Integer> response = Syncano.please(Book.class).getCountEstimation();\nInteger count = response.getData();", "language": "java", "name": "Android" }, { "code": "SCPlease *please = [Book please];\n[please giveMeDataObjectsWithParameters:@{SCPleaseParameterIncludeCount : @(YES)} completion:^(NSArray *objects, NSError *error) { \n NSNumber *objectsCount = please.objectsCount;\n}];", "language": "objectivec" }, { "code": "let please:SCPlease = Book.please()\nplease.giveMeDataObjectsWithParameters([SCPleaseParameterIncludeCount : true]) { (objects, error) in\n let objectsCount:NSNumber = please.objectsCount\n}", "language": "objectivec", "name": "Swift" }, { "code": "// NOT AVAILABLE", "language": "csharp", "name": "Unity" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"prev\":null,\n \"objects_count\":48843,\n \"objects\":[],\n \"next\":null\n}", "language": "json" }, { "code": "48837", "language": "python" } ] } [/block]