The used database instance is a MongoDB instance running on the BIC, storing all application data. The admin database management page can be accessed https://definma-db.apps.de1.bosch-iot-cloud.com/api-doc/ . However, it is recommended to use a dedicated MongoDB application for anything apart from a quick look. The two tested applications are MongoDB Compass and Robo 3T (recommended for trying queries).
To connect to the BIC instance from your local application follow the BIC guide.
TLDR:

For the first time:

- cf login
- cf enable-ssh <app-name, probably definma-api>
- cf create-service-key <service-name, probably definmadb> <key-name, can be whatever>

Every time:

- cf ssh -L 1120:st0cvm200118.internal-mongodb.de1.bosch-iot-cloud.com:30000 definma-api
- Login into your application with localhost:1120 and use credentials and Authentication Database from the BIC (Data can be found at Home>DeFinMa>production>definma-api>Services>dots on the right of definmadb>View Credentials)

###### Backup

For creating a database backup, you must follow the same steps from above (except the last one). Additionally you need the mongodump installed. Open the MongoDB bin folder (normally at C:\Program Files\MongoDB\Server\4.2\bin) in a PowerShell and execute following command for backup, adjust parameters and credentials as needed:
.\mongodump.exe /port:1120 /db:"6ebe4c5d-0da3-4347-b484-66894dcf3f27" /username:"<username>" /password:"<username>" /out:"C:\Path\to\backup\folder"
Restoring the database from a backup is done with mongorestore.exe, more information can be found at the documentation.
The BIC service also creates internal backup, which can be requested to restore, see MongoDB FAQ

#### Database model

#### Field reference

samplesExample
_id Automatically generated unique id '5f2e63c98d1c020f8cda6e06'
type The material status of the sample, can be either as-delivered/raw or processed. 'processed'
number The sample number, generated by the server for new samples 'An31'
color Sample color 'black'
batch Batch number the sample was from '2264486614'
status Status of the document, can be either new, validated or deleted. 'new'
condition sample condition with condition_template reference and all fields defined by the template {{'{'}}condition_template: '5f3151b5b8a886007d2de9ed', time in minutes: 30{{'}'}}
material_id Reference to the sample material '5f2e63118d1c020f8cda6a0a'
note_id Reference to the sample note '5f2e63c98d1c020f8cda6e08'
user_id Reference to the user who created the sample '5f294dd4aa9ea5085c7d7315'
notes
_id Automatically generated unique id '5f2e63e98d1c020f8cda70cc'
comment General remarks 'stabilized'
sample_references Array of references to other samples, each reference containing the referenced sample_id as well as a relation field describing the relationship {{'{'}}sample_id: '5f2e63d68d1c020f8cda701c', relation: 'belongs to'{{'}'}}
custom_fields Additional information as key value pairs for the sample, making it easier to process this information {{'{'}}vwz: '0 min'{{'}'}}
note_fields
_id Automatically generated unique id '5f2e63e98d1c020f8cda70ce'
name name of the custom_fields key 'test series'
qty number of notes with this key 24
materials
_id Automatically generated unique id '5f2e63e98d1c020f8cda70d0'
name Trade name of the material 'Ultradur B4300 G6'
numbers Bosch material part numbers ['5515753021, '5515753404']
properties material class specific properties with material_template reference and all fields defined by the template {{'{'}}material_template: '5f2e89874ac96c007fb06e83', mineral: 0, glass_fiber: 30, carbon_fiber: 0{{'}'}}
group_id Reference to the material group '5f2e631191c5d68f8a0708c4'
supplier_id Reference to the material supplier '5f2e631191c5d68f8a0708c7'
status Status of the document, can be either new, validated or deleted. 'new'
material_groups
_id Automatically generated unique id '5f2e631291c5d68f8a0708f9'
name The chemical material type 'PA66'
material_supplier
_id Automatically generated unique id '5f2e631991c5d68f8a0709c3'
name The material supplier 'BASF'
measurements
_id Automatically generated unique id '5f294d25aa9ea5085c7d7305'
sample_id Reference to the sample this measurement belongs to '5f2e63c98d1c020f8cda6e06'
measurement_template Reference to the Template defining the structure of the measurement values '5f294d25aa9ea5085c7d7305'
values Measurement values in defined format {{'{'}}vn: 100.4{{'}'}}
status Status of the document, can be either new, validated or deleted. 'new'
<collection>_templates
_id Automatically generated unique id '5f2e63ee8d1c020f8cda7128'
name Display name of the template 'spectrum'
version Version number of the template 2
first_id Reference to the first instance of this template with version number 1 '5f2e89bb4ac96c007fb06e86'
parameters Specified parameters of this template. The name property is used as the key in the document using this template, the range can have the following properties: min specifies the minimum numeric value, max specifies the maximum numeric value, values specifies an array of allowed values of this parameter and type: 'array' specifies that this parameter must be an array
users
_id Automatically generated unique id '5f2e63cc8d1c020f8cda6e6a'
name The username 'admin'
email The user's email address used for password reset 'test@bosch.com'
location The abbreviation of the Bosch site of the user 'Rng'
level The permission level, can be either read, write, dev or admin. The exact level permissions can be found at the general documentation
devices Array of all spectrum measurement devices the user has access to ['Rng01', 'Rng02']
pass The user's password in hashed form using bcrypt '$2a$10$m8DqvZR3plZEv8EPwPo7Luvyrm/ZQDiPzfBh6bpU/1XFWOGONkJyG'
key The API key, generated when the user is created '5f294dd4aa9ea5085c7d7314'
models Reference to the prediction models the user should have access to. Ignored for dev and admin as they automatically have access to all models. ['5f466fb1e566810dd8b3e919', '5f294d8aaa9ea5085c7d730b']
status Status of the document, can be either new, validated or deleted. 'new'
models
group group the model belongs to 'VN'
models models of the group with _id, name and url to the Python endpoint {{'{'}}_id: '5f466fb1e566810dd8b3e919', name: POM, url: 'http://localhost:9099/test'{{'}'}}
model_files
_id Automatically generated unique id '5f294d47aa9ea5085c7d7308'
name The name of the model 'humidity-1'
data The Python model data in binary format <binary data>
changelogs
_id Automatically generated unique id '5f2e63cc8d1c020f8cda6e6e'
action The URL which invoked the database write access 'POST /material/new'
collection_name Collection that was written to 'material_groups'
conditions Condition arguments used when accessing the database {{'{'}}id: '5f2e63118d1c020f8cda6a0a'{{'}'}}
data data which was written to the database {{'{'}}name: 'PBT'{{'}'}}
user_id The user that executed this command '5f2e63118d1c020f8cda6a09'
help
_id Automatically generated unique id '5f2e63d28d1c020f8cda6f86'
key The key used to find the required help text '/documentation/database'
level The minimum level required to read this help 'write'
text The actual help text 'This page documents the database.'