MongoDB
This section contains information on the configuration and the data type mapping of MongoDB databases.
Declaration in the TwinCAT Database Server Configurator
MongoDB | |
---|---|
Database Type | Select "MongoDB" from the drop-down menu. |
Server | Enter the name of your MongoDB server. |
Database | Enter the name of the database. If the database does not yet exist, it is created the first time it is accessed. |
Authentication | None: No authentication User name/password: Login with user name and password x509 certificate: GSSAPI/Kerberos: Login with user name and password LDAP(PLAIN): Login with user name and password |
Windows CE support Under Windows CE this database is not supported by the TwinCAT Database Server. |
Data type mapping between DB and PLC
MongoDB | TwinCAT PLC |
---|---|
long | LINT |
int | DINT |
bool | BYTE |
double | LREAL |
timestamp | DT |
string | STRING |
binData | ARRAY OF BYTE |
objectId | T_ObjectId_MongoDB |
array | ARRAY |
object | STRUCT |
Data type support WSTRING is not supported by this database. (See WString support) |
MongoDB in PLC Expert/Configure mode
PLC Expert and Configure mode use the predefined database schema in their processes. Normally, the schema of the structures used will not change during operation. In order to nevertheless be able to use the function blocks, the TwinCAT 3 Database Server requires a description of the table schema. For MongoDB a table is therefore simulated.
In the SQL Query Editor, use the SQL tab and the CREATE TABLE subcategory to create a table, or in this case a collection. In addition, unlike for relational databases, an entry is created in a metadata collection. Information on the table schema for the TwinCAT 3 Database Server is stored here.
In order to use advanced functionality, e.g. structures of any hierarchy or flexible records, we recommend using the NoSQL function blocks.
Use of certificates
Among other things, MongoDB supports authentication by means of certificates. To this end, select the 'x509 certificate' method under Authentication. The following fields appear:
User name | User name of the corresponding certificate |
Certificate Authority | Path to the SSL certificate of the certificate authority. This may be a self-signed certificate. |
Client Certificate | Client certificate signed by the SSL certificate. |
Client Certificate Password | Password of the client certificate. |
Configuring the database connection to MongoDB using certificates:
Notice | |
Data security In flash memory devices the number of write access operations is limited. The flash memory devices can fail, with a risk of data loss.
|