Documents
- A document is a single JSON object which contains data
- The data stored on the document can be system generated, user generated or a combination of both.
- In it's simplest form a document will almost always have the following:
- A unique, system generated document Id;
- A 'systemHeader' object which contains system related data;
- Application Data - various key/value pairs which represent data captured in the application
An example of a document note the opening curly brace and closing curly brace, signifying the whole set of information is a JSON object :
{
"dateSubmitted": "2017-02-02T12:22:22.366Z",
"reporter": [
{
"documentId": "1a665e70-e6be-11e6-8e4e-09fc4290540c",
"name": "User Account - hubzero9@gmail.com"
}
],
"assignedTo": [
{
"documentId": "3d0be4e0-5eb5-11e6-8590-4be029f2f57f",
"name": "User Account - barry.r.eadie@gmail.com"
}
],
"issueSeverity": "Minor",
"issuePriority": "Normal",
"Environment": "Master",
"platformVersion": "gobble.io Version 0.5.42",
"browser": "",
"reproducibility": "Always",
"status": "Closed",
"resolution": "Fixed",
"summary": "gbl-check-list > disabled by default",
"issues": "The gbl-check-list is by default set to enabled:false this prevents input to the checklist during declaration and requires the user to state enabled:true during component declaration, this parameter is supposed to be optional. Can you please set it to enabled by default.<br><br>this issue is also present in MS Edge",
"appTags": [
"formbird",
"Issue/Request Details"
],
"lastUpdate": "2017-02-08T04:23:28.418Z",
"systemHeader": {
"systemType": "document",
"templateId": "80e75b50-bb5c-11e6-943f-8deecc4f8938",
"createdWith": "80e75b50-bb5c-11e6-943f-8deecc4f8938",
"versionId": "fc179ca0-fef4-11e6-8eb2-17a4748f5de1",
"keyIds": [],
"excludeGeneralSearch": false,
"currentVersion": true,
"createdDate": "2017-03-02T03:04:43.626Z",
"createdBy": "1a665e70-e6be-11e6-8e4e-09fc4290540c",
"summaryName": "21",
"summaryDescription": "Issue/Request 21",
"previousVersionId": "56e5a460-edb6-11e6-8574-e9ac173aaf32",
"serverCreatedDate": "2017-03-02T03:04:43.626Z",
"serverUpdatedDate": "2017-03-02T03:04:43.626Z"
},
"documentId": "efdd7440-e942-11e6-9c38-1d12f3fd75a7",
"issueId": "21",
"browsersImpacted": [
"Chrome",
"Firefox",
"MS Edge",
"MS IE",
"Safari",
"iPhone Safari",
"iPad Safari",
"Android Phone",
"Android Tablet"
],
"browsersTested": [
"Chrome",
"Firefox",
"MS Edge",
"MS IE",
"Safari",
"iPhone Safari",
"iPad Safari",
"Android Phone",
"Android Tablet"
]
}
Let's have a look at the various fields on the document: - The systemHeader field is an object where the system data is stored
"systemHeader": {
"systemType": "document",
"templateId": "80e75b50-bb5c-11e6-943f-8deecc4f8938",
"createdWith": "80e75b50-bb5c-11e6-943f-8deecc4f8938",
"versionId": "fc179ca0-fef4-11e6-8eb2-17a4748f5de1",
"keyIds": [],
"excludeGeneralSearch": false,
"currentVersion": true,
"createdDate": "2017-03-02T03:04:43.626Z",
"createdBy": "1a665e70-e6be-11e6-8e4e-09fc4290540c",
"summaryName": "21",
"summaryDescription": "Issue/Request 21",
"previousVersionId": "56e5a460-edb6-11e6-8574-e9ac173aaf32",
"serverCreatedDate": "2017-03-02T03:04:43.626Z",
"serverUpdatedDate": "2017-03-02T03:04:43.626Z"
},
Full details about the systemHeader will be covered in a later topic, but for now, the interesting parts of the systemHeader include: - "systemHeader.systemType":"document" - this signifies that the document is of type 'document'. This can be a little confusing, but there are three main systemTypes - 'document' and 'template' and 'account' - these are all 'documents' of a particular type. - "systemHeader.templateId":"80e75b50-bb5c-11e6-943f-8deecc4f8938" - this is the 'documentId' of the document that created this particular document.
The documentId is the unique identifier of the document. This is system generated and there will only ever be 1 documentId for a document;
"documentId": "efdd7440-e942-11e6-9c38-1d12f3fd75a7",
Application Data: Example of an array:
"browsersTested": [
"Chrome",
"Firefox",
"MS Edge",
"MS IE",
"Safari",
"iPhone Safari",
"iPad Safari",
"Android Phone",
"Android Tablet"
]
Example of a simple text field:
"issueSeverity": "Minor",
Example of an array with a single object within:
"reporter": [
{
"documentId": "1a665e70-e6be-11e6-8e4e-09fc4290540c",
"name": "User Account - hubzero9@gmail.com"
}
],
Example of a date:
"dateSubmitted": "2017-02-02T12:22:22.366Z",