{"__v":41,"_id":"54e4d1b418155617007884de","category":{"__v":16,"_id":"54e49219e4365521006fd9ee","pages":["54e4934e610dfd0d00b2a863","54e49857610dfd0d00b2a869","54e4d1b418155617007884de","54e4eaff1815561700788522","54e50932d71c112d005440e6","54e50982d71c112d005440e8","54e612b3cf61ff0d00cf95b6","54e62e81a6972f0d002556d6","54ec82cb5033a62b005b257a","54edebbe3749bf0d00c764f8","54ededd28dafa7250027e64d","54ee3be3ae79c92d000f41b4","54ee4c11df57670d00871c8e","54f9ba2167e8f20d0096da6f","54fdf1e47ed77417002c5384","55106b1a23eca20d0038d0dc"],"project":"54d0fd1d095c470d00d1646d","version":"54d0fd1e095c470d00d16470","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-18T13:22:33.459Z","from_sync":false,"order":0,"slug":"guides","title":"Guides"},"project":"54d0fd1d095c470d00d1646d","user":"54db646008ea010d00ab1fe1","version":{"__v":20,"_id":"54d0fd1e095c470d00d16470","project":"54d0fd1d095c470d00d1646d","createdAt":"2015-02-03T16:53:50.090Z","releaseDate":"2015-02-03T16:53:50.090Z","categories":["54d0fd1e095c470d00d16471","54d8b5e68934140d00496544","54db6361c6a4d40d0034b8f7","54db638208ea010d00ab1fdd","54db639008ea010d00ab1fde","54db6547c6a4d40d0034b8fd","54db83482092743700ea6ee1","54db84afc6a4d40d0034b93c","54db8805c6a4d40d0034b93f","54db8de9c6a4d40d0034b961","54db931ac6a4d40d0034b96d","54e49219e4365521006fd9ee","54e74fcc652d7c1900cbe737","54e74ffd3c1e111700d05762","54e77e0a523b1b2f00e6f313","54e784affdabe62500fcddcf","54e784fa523b1b2f00e6f319","54e785de8ae8911900cd42c5","54fdad6e660db63700c23b82","54fdff31f7b1202100a25e06"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-02-18T17:53:56.233Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"In **goGeo**, all inserted data is organized following an hierarchical structure. The top level structure for storing data is a **database**. Databases are namespaces that you can use to group  **collections**. This way, one may create two collections with the same name under different databases without naming conflicts, making easier to manage different projects. The Table 1 show the attributes of a database.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Attribute\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Properties\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"String\",\n    \"0-2\": \"read-only\",\n    \"0-3\": \"The database internal ID - a hash generated automatically by the system on creation\",\n    \"1-0\": \"user_id\",\n    \"1-1\": \"String\",\n    \"1-2\": \"read-only\",\n    \"1-3\": \"The database owner's user ID\",\n    \"2-0\": \"database_name\",\n    \"2-1\": \"String\",\n    \"2-2\": \"required\\nread-only\",\n    \"2-3\": \"The database name. Must be unique.\",\n    \"3-0\": \"description\",\n    \"3-1\": \"String\",\n    \"3-2\": \"optional\",\n    \"3-3\": \"A complementary database text description\"\n  },\n  \"cols\": 4,\n  \"rows\": 4\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<div class='footer_table'>\\nTable 1 - Table of Database attributes.\\n</div>\\n\\n<style>\\n  .footer_table {\\n  \\ttext-align: center;\\n    max-width: 400px;\\n    margin: 10px auto 0px;\\n    color: #888;\\n    font-size: 0.9em;\\n    margin-top: -21px;\\n  }\\n</style>\"\n}\n[/block]\nA collection in **goGeo** platform is equivalent to a table from relational databases. Each collection is associated to a database and aims to group a set of **documents**. The Table 2 show the attributes of a collection. A collection is also associated to a schema, which defines its internal structure and restricts the data that can be inserted after created. Collection's schem is defined when a **metadata**  structure is provided on file import.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Attribute\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Properties\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"database_id\",\n    \"0-1\": \"String\",\n    \"0-2\": \"required\\nread-only\",\n    \"0-3\": \"The identifier of the database containing the collection. To define the database associated to collection, you can use the database identifier or the name of the database\",\n    \"1-0\": \"collection_name\",\n    \"1-1\": \"String\",\n    \"1-2\": \"required\\nread-only\",\n    \"1-3\": \"The collection name.\",\n    \"2-0\": \"description\",\n    \"2-1\": \"String\",\n    \"2-2\": \"optional\",\n    \"2-3\": \"Collection description\",\n    \"3-3\": \"Collection identifier\",\n    \"4-3\": \"Public collection identifier associated with this collection.\",\n    \"5-3\": \"Name of the user who created the collection\",\n    \"6-3\": \"Defines if the collection will be public\",\n    \"6-2\": \"read-only\",\n    \"5-2\": \"read-only\",\n    \"4-2\": \"read-only\",\n    \"3-2\": \"read-only\",\n    \"3-1\": \"String\",\n    \"4-1\": \"String\",\n    \"5-1\": \"String\",\n    \"6-1\": \"String\",\n    \"3-0\": \"id\",\n    \"4-0\": \"origin\",\n    \"5-0\": \"username\",\n    \"6-0\": \"public\"\n  },\n  \"cols\": 4,\n  \"rows\": 7\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<div class='footer_table'>\\nTable 2 - Table of Collection attributes.\\n</div>\\n\\n<style>\\n  .footer_table {\\n  \\ttext-align: center;\\n    max-width: 400px;\\n    margin: 10px auto 0px;\\n    color: #888;\\n    font-size: 0.9em;\\n    margin-top: -21px;\\n  }\\n</style>\"\n}\n[/block]\nCollections may be classified according to their access restrictions. They may be shared or private. In private collections, only the owner can use it through access keys. Shared collections, in the other hand, may be accessed by any user, but first, it must be imported using the [Collections](doc:collections) API. In fact, this creates a private collection that *links* to a shared collection. Both shared and public collections can only be edited by owner \n\nAll operations involving databases, collections and documents must use a **API-KEY**, which is a unique identifier for each user, and allows database management, collection creations and insertion, among other data sensitive operations.\n\n###**Documents Structure**\n\nDocuments are similar to rows in relational databases, but with a geographic location associated. They may be inserted individually or in batches through file uploads, using both API and Console. Each inserted document must be associated to a collection.\n\nThe document location may be a point, a line or a polygon with georeferenced coordinates.  It is also important to give valid attribute names and make use of supported types when inserting data.\n\n###**Naming Rules**\n\nWhen a database or a collection is created, as well as documents attributes are defined, valid words must be used to name these entities. A valid name in **goGeo** is any sequence of alphanumeric characters in addition to underscores, providing the first character must be a letter. All names are converted to their lowercase form when passed to **goGeo**. The valid names for **goGeo** entities can be described by the following regular expression:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[a-z][_a-z0-9]*\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n---\n[block:html]\n{\n  \"html\": \"<div class='div-middle'> \\n  <a href='#'>\\n    Top page &spades; </div>\\n  </a>\\n</div>\\n\\n<div class='div-back'> \\n  <a href='/v1.0/docs/console'>\\n    &laquo; Back \\n  </a>\\n</div>\\n\\n<div class='div-forward'> \\n  <a href='/v1.0/docs/data-insertion'>\\n    Next &raquo; </div>\\n  </a>\\n</div>\\n\\n<style>\\n\\t.div-back {\\n  \\tpadding-left: 15px;\\n\\t\\tmargin-top: -20px;\\n  }\\n  \\n  .div-middle {\\n  \\ttext-align: center;\\n\\t\\tmargin-top: -15px;\\n  }\\n  \\n  .div-forward {\\n  \\tfloat: right;\\n    padding-right: 15px;\\n\\t\\tmargin-top: -20px;\\n  }\\n</style>\"\n}\n[/block]","excerpt":"","slug":"data-model","type":"basic","title":"Data Model"}
In **goGeo**, all inserted data is organized following an hierarchical structure. The top level structure for storing data is a **database**. Databases are namespaces that you can use to group **collections**. This way, one may create two collections with the same name under different databases without naming conflicts, making easier to manage different projects. The Table 1 show the attributes of a database. [block:parameters] { "data": { "h-0": "Attribute", "h-1": "Type", "h-2": "Properties", "h-3": "Description", "0-0": "id", "0-1": "String", "0-2": "read-only", "0-3": "The database internal ID - a hash generated automatically by the system on creation", "1-0": "user_id", "1-1": "String", "1-2": "read-only", "1-3": "The database owner's user ID", "2-0": "database_name", "2-1": "String", "2-2": "required\nread-only", "2-3": "The database name. Must be unique.", "3-0": "description", "3-1": "String", "3-2": "optional", "3-3": "A complementary database text description" }, "cols": 4, "rows": 4 } [/block] [block:html] { "html": "<div class='footer_table'>\nTable 1 - Table of Database attributes.\n</div>\n\n<style>\n .footer_table {\n \ttext-align: center;\n max-width: 400px;\n margin: 10px auto 0px;\n color: #888;\n font-size: 0.9em;\n margin-top: -21px;\n }\n</style>" } [/block] A collection in **goGeo** platform is equivalent to a table from relational databases. Each collection is associated to a database and aims to group a set of **documents**. The Table 2 show the attributes of a collection. A collection is also associated to a schema, which defines its internal structure and restricts the data that can be inserted after created. Collection's schem is defined when a **metadata** structure is provided on file import. [block:parameters] { "data": { "h-0": "Attribute", "h-1": "Type", "h-2": "Properties", "h-3": "Description", "0-0": "database_id", "0-1": "String", "0-2": "required\nread-only", "0-3": "The identifier of the database containing the collection. To define the database associated to collection, you can use the database identifier or the name of the database", "1-0": "collection_name", "1-1": "String", "1-2": "required\nread-only", "1-3": "The collection name.", "2-0": "description", "2-1": "String", "2-2": "optional", "2-3": "Collection description", "3-3": "Collection identifier", "4-3": "Public collection identifier associated with this collection.", "5-3": "Name of the user who created the collection", "6-3": "Defines if the collection will be public", "6-2": "read-only", "5-2": "read-only", "4-2": "read-only", "3-2": "read-only", "3-1": "String", "4-1": "String", "5-1": "String", "6-1": "String", "3-0": "id", "4-0": "origin", "5-0": "username", "6-0": "public" }, "cols": 4, "rows": 7 } [/block] [block:html] { "html": "<div class='footer_table'>\nTable 2 - Table of Collection attributes.\n</div>\n\n<style>\n .footer_table {\n \ttext-align: center;\n max-width: 400px;\n margin: 10px auto 0px;\n color: #888;\n font-size: 0.9em;\n margin-top: -21px;\n }\n</style>" } [/block] Collections may be classified according to their access restrictions. They may be shared or private. In private collections, only the owner can use it through access keys. Shared collections, in the other hand, may be accessed by any user, but first, it must be imported using the [Collections](doc:collections) API. In fact, this creates a private collection that *links* to a shared collection. Both shared and public collections can only be edited by owner All operations involving databases, collections and documents must use a **API-KEY**, which is a unique identifier for each user, and allows database management, collection creations and insertion, among other data sensitive operations. ###**Documents Structure** Documents are similar to rows in relational databases, but with a geographic location associated. They may be inserted individually or in batches through file uploads, using both API and Console. Each inserted document must be associated to a collection. The document location may be a point, a line or a polygon with georeferenced coordinates. It is also important to give valid attribute names and make use of supported types when inserting data. ###**Naming Rules** When a database or a collection is created, as well as documents attributes are defined, valid words must be used to name these entities. A valid name in **goGeo** is any sequence of alphanumeric characters in addition to underscores, providing the first character must be a letter. All names are converted to their lowercase form when passed to **goGeo**. The valid names for **goGeo** entities can be described by the following regular expression: [block:code] { "codes": [ { "code": "[a-z][_a-z0-9]*", "language": "shell" } ] } [/block] --- [block:html] { "html": "<div class='div-middle'> \n <a href='#'>\n Top page &spades; </div>\n </a>\n</div>\n\n<div class='div-back'> \n <a href='/v1.0/docs/console'>\n &laquo; Back \n </a>\n</div>\n\n<div class='div-forward'> \n <a href='/v1.0/docs/data-insertion'>\n Next &raquo; </div>\n </a>\n</div>\n\n<style>\n\t.div-back {\n \tpadding-left: 15px;\n\t\tmargin-top: -20px;\n }\n \n .div-middle {\n \ttext-align: center;\n\t\tmargin-top: -15px;\n }\n \n .div-forward {\n \tfloat: right;\n padding-right: 15px;\n\t\tmargin-top: -20px;\n }\n</style>" } [/block]