Skip to main content
Skip table of contents

MongoDB Adapter Reference

This page explains the MongoDB Adapter in Bridge context. If you were looking for the same information regarding the PAS Designer, refer to MongoDB Adapter in the Designer guide.

Tagged Values

<<MongoDBAlias>>

The settings on the <<MongoDBAlias>> are used to build the MongoDB connection string and to set database connection options. Each alias will create a separate connection pool. For each request, the xUML Runtime will use one connection from this pool for the entire request duration.

To use the MongoDB adapter it is helpful if you are familiar with the MongoDB options. Each listed tagged value is setting the MongoDB option having the same name.
Please refer to the MongoDB manual for more information on each option.

Tagged ValueDescriptionAllowed Values / Examples
Protocol
(protocol)

Specifies the protocol to be used with this connection.mongodbUse the standard MongoDB connection protocol (default).
mongodb+srvUse DNS seed list.
Hosts
(hosts)
Specifies a list of MongoDB host with optional ports (one list entry per line).
scheer-acme.com
db.scheer-acme.com:2701
Replica Set
(replicaSet)
Specifies a replica set name.
Database
(database)
Specifies the default database to be used.
Collection
(collection)
Specifies the default collection to be used.
xUML Runtime Use Transactions
(xUMLRuntimeUseTransactions)

Specifies whether to use automatic transactions with replica sets. If enabled, the xUML Runtime will apply the transaction concepts as documented on xUML Runtime Transaction Concepts.

Transactions can only be enabled when using replica sets. Also, some options like read/write concerns make it impossible to use transactions. If a conflict can be detected, the Runtime refuses to start.
Use with caution, and refer to the MongoDB manual for more information.

true

Use automatic transactions on replica sets.

falseDo not use automatic transactions on replica sets (default).
Authentication
User
(user)
Specifies the database user (if the database requires authentication). If the user contains characters that MongoDB has defined as to be illegal, they will be converted correctly to percent encoding.
Password
(password)
Specifies the password of user (if the database requires authentication). If the password contains characters that MongoDB has defined as to be illegal, they will be converted correctly to percent encoding.
Defaultauthdb
(defaultauthdb)
Specifies the defaultauthdb option, the authentication database to be used if user and password are provided.
Auth Source
(authSource)
Specifies the authSource option, the database name that is associated with the provided credentials.
Auth Mechanism
(authMechanism)
Specifies the authMechanism option, the authentication mechanism to be used to authenticate the connection.
Auth Mechanism Properties
(authMechanismProperties)
Specifies the authMechanismProperties option, the properties of the specified authMechanism as a comma-separated list of colon-separated key-value pairs.
CANNONICALIZE_HOST_NAME:true,AWS_SESSION_TOKEN:FQoGZXIvYXdzEN...
Compression
Compressors
(compressors)
Specifies the compressors option, the compressor to be used for network communication.zlibUse zlib compression.
noneNo compression.
Zlib Compression Level
(zlibCompressionLevel)
Specifies the zlibCompressionLevel option, compression level if zlib compression is used.-1zlib default
0no compression
1-9compression level
Misc
Retry Reads
(retryReads)
Specifies the retryReads option. This option enables retryable reads.trueRetry reads (default).
falseDo not retry reads.
Retry Writes
(retryWrites)
Specifies the retryWrites option. This option enables retryable writes.trueRetry writes (default)
falseDo not retry writes.
Pooling
Max Pool Size
(maxPoolSize)
Specifies the maxPoolSize option, the maximum number of connections in the connection pool.any positive integer
100default
Wait Queue Timeout MS
(waitQueueTimeoutMS)
Specifies the waitQueueTimeoutMS option, the maximum wait time for a client connection to become available from the pool.any positive integer
30000default
Read Concern
Read Concern Level
(readConcernLevel)
Specifies the readConcernLevel option. Refer to the MongoDB manual for more details.One of: local (default), majority, linearizable, available, snapshot
Read preference
Read Preference
(readPreference)
Specifies the readPreference option. Refer to the MongoDB manual for more details.One of: primary (default), primaryPreferred, secondary, secondaryPreferred, nearest
Max Staleness Seconds
(maxStalenessSeconds)
Specifies the maxStalenessSeconds option, how stale a secondary can be before the client stops using it for read operations.any positive integer >= 90
-1default
ReadPreferenceTags
(readPreferenceTags)
Specifies the readPreferenceTags option.
Server selection & discovery
Local Threshold MS
(localThresholdMS)
Specifies the localThresholdMS option.any positive integer
15default
Server Selection Timeout MS
(serverSelectionTimeoutMS)
Specifies the serverSelectionTimeoutMS option.any positive integer
30000default
Heartbeat Frequency MS
(heartbeatFrequencyMS)
Specifies the heartbeatFrequencyMS option.any positive integer
10000default
TLS
Tls
(tls)
Specifies the tls option, used to enable/disable TLS.trueEnable TLS.
falseDisable TLS (default).
Tls Certificate Key File
(tlsCertificateKeyFile)
Specifies the tlsCertificateKeyFile option, the path to a .pem file that contains either the TLS/SSL X.509 certificate of the client, or the client's TLS/SSL certificate and key.
Tls Certificate Key File Password
(tlsCertificateKeyFilePassword)
Specifies the tlsCertificateKeyFilePassword option, the password to decrypt the certificate file.
Tls CA File
(tlsCAFile)
Specifies the tlsCAFile option, the path to a .pem file that contains the root certificate chain of the certificate authority. This file is used to validate the certificate presented by the database instance.
Tls Allow Invalid Certificates
(tlsAllowInvalidCertificates)
Specifies the tlsAllowInvalidCertificates option, used to allow invalid certificates.trueBypass certifiate validation.
falseValidate the certificate presented by the database instance (default).
Tls Allow Invalid Hostnames
(tlsAllowInvalidHostnames)
Specifies the tlsAllowInvalidHostnames option, used to disable hostname validation.trueDo not validate the hostname of the certificate presented by the database instance.
falseValidate the hostname of the certificate presented by the database instance (default).
Tls Insecure
(tlsInsecure)
Specifies the tlsInsecure option.trueDisable TLS various certificate validations. Refer to the MongoDB manual for details.
falseValidate TLS certificates (default).
Timeout
Connect Timeout MS
(connectTimeoutMS)
Specifies the connectTimeoutMS option, the time in milliseconds a connection is attempted before it times out.any positive integer
30000default
Socket Timeout MS
(socketTimeoutMS)
Specifies the socketTimeoutMS option, the time in milliseconds a send or receive is attempted on a socket before it times out.any positive integer
30000default
Write Concern
W
(w)
Specifies the w option. This option requests acknowlegdement that a write operation has been propagated to the specified number of MongoDB instances or MongoDB instances with specific tags.a positive integer
(default 1)
Acknowledge propagation to the given number of databases.
majorityAcknowledge propagation to the majority of databases.
a tag setAcknowledge propagation to the databases with the specified tags.
Wtimeout MS
(wtimeoutMS)
Specifies the wtimeoutMS option, the time limit for the write concern in milliseconds.any positive integer
30000default
Journal
(journal)
Specifies the journal option. This option requests acknowlegdement from the database that the write operation has been written to the journal.trueRequest acknowlegdement for write operations.
falseNo acknowlegdement of write operations (default).

<<MongoDBAdapter>>

Tagged ValueDescriptionAllowed Values
Alias
(alias)
Specify the MongoDB alias resp. the database the adapter should connect to.a valid MongoDB alias

Database
(database)
Overwrite the database given in the alias.

Collection
(collection)
Overwrite the collection given in the alias.

Action
(action)
Holds the action to perform on the database.insertInsert a new document.
findFind a document.
aggregateExecute an aggregation operation.
fetchFetch the next document from a result set.
updateUpdate a document.
replaceReplace a document.
deleteDelete a document.

MongoDB Adapter Parameters

Action "find"

NameTypeDirectionDescriptionAllowed Values / Examples
databaseStringin

Name of the database you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.


collectionStringin

Name of the collection you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.


optionsMongoDBFindOptionsinMongoDB options for find.
queryStringStringin

MongoDB JSON query string.

In contrast to the MongoDB shell, the JSON keys must be quoted properly.

MongoDB query string as valid JSON
handleMongoDBHandleoutHandle to a result set. You can use fetch to get documents from this result set.
resultArray of StringArray of all resulting documents in JSON format.out

Result set as an array. Depending on the array element specified on this parameter, the resulting documents are either presented in extended JSON format (String), or serialized into xUML model structures (<document class>).


Array of <document class>Array of objects of an xUML class representing the document structure.

Action "fetch"

NameTypeDirectionDescription
handleMongoDBHandleinHandle to a result set that has been created by a find action.
resultStringResulting document in JSON format.outFetched document. Depending on the type specified on this parameter, the resulting document is either presented in extended JSON format (String), or serialized into  model structures (<document class>).
<document class>Objects of an xUML class representing the document structure.

Action "aggregate"

NameTypeDirectionDescription
databaseStringin

Name of the database you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.

collectionStringin

Name of the collection you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.

pipelineArray of Stringin
Pipeline you want to use with aggregation.


Each array element must be a MongDB pipeline step as valid JSON.

handleMongoDBHandleoutHandle to a result set. You can use fetch to get documents from this result set.
result

Array of String

Array of all resulting documents in JSON format.out

Result set as an array. Depending on the array element specified on this parameter, the resulting documents are either presented in extended JSON format (String), or serialized into xUML model structures (<document class>).

Array of <document class>Array of objects of an xUML class representing the document structure.

Action "insert"

NameTypeDirectionDescription
databaseStringin

Name of the database you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.

collectionStringin

Name of the collection you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.

document<document class>inA data structure representing the document you want to insert. The data structure will be serialized.
documentsArray of <document class>inArray of documents you want to insert. Each array element is treated as a single document parameter and all of them will be inserted.

Action "update"

NameTypeDirectionDescriptionAllowed Values / Examples
databaseStringin

Name of the database you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.


collectionStringin

Name of the collection you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.


pipelineArray of Stringin

Pipeline you want to use with update.

Each array element must be a MongDB pipeline step as valid JSON.


optionsMongoDBUpdateOptionsinMongoDB options for update.
nullificationsArray of Stringin

An array of database fields to be set to NULL upon update.

The elements of the path to the field within the corresponding document are to be separated by a dot (see examples). You can use arrays with that notation (see example) only if arrayFilters have been provided with the MongoDB update options.

customer.address
customer.address.street
customer.phoneArray.$[elem].number
removalsArray of Stringin

An array of database fields to be removed upon update.

The elements of the path to the field within the corresponding document are to be separated by a dot (see examples). You can use arrays with that notation (see example) only if arrayFilters have been provided with the MongoDB update options.

customer.address
customer.address.street
customer.phoneArray.$[elem].number
queryStringStringin

MongoDB JSON query string.

In contrast to the MongoDB shell, the JSON keys must be quoted properly.

MongoDB query string as valid JSON
documentAny <document class>in

A data structure representing the document you want to insert. For this, the following rules apply:

  • unset top-level fields will be skipped
  • complex fields will be replaced entirely



updateStringStringin

MongoDB JSON update string.

In contrast to the MongoDB shell, the JSON keys must be quoted properly.

Refer to Querying MongoDB for a comprehensive explanation of how to build an update string and the implications.

MongoDB update string as valid JSON

{ "$set": {
      "address": {
            "city": "Dallas"
      }
}
{ "$set": {
     "address.city": "Dallas"
     }
}
rowsAffectedIntegerout

Returns how many rows have been affected by the action.

This information may be unavailable depending on the acknowledgement settings on the <<MongoDBAlias>>. If the Runtime cannot retrieve this information, rowsAffected will be NULL.


Action "replace"

NameTypeDirectionDescriptionAllowed Values / Examples
databaseStringin

Name of the database you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.


collectionStringin

Name of the collection you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.


optionsMongoDBReplaceOptionsinMongoDB options for replace.
queryStringStringin

MongoDB JSON query string.

In contrast to the MongoDB shell, the JSON keys must be quoted properly.

MongoDB query string as valid JSON
documentAny <document class>in

A data structure representing the document you want to replace the selected document with. The old stored document will be replaced by the new one, the MongoDB _id, however, will not change.



rowsAffectedIntegerout

Returns how many rows have been affected by the action.

This information may be unavailable depending on the acknowledgement settings on the <<MongoDBAlias>>. If the Runtime cannot retrieve this information, rowsAffected will be NULL.


Action "delete"

NameTypeDirectionDescriptionAllowed Values / Examples
databaseStringin

Name of the database you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.


collectionStringin

Name of the collection you want to access. This overwrites the setting on the <<MongoDBAlias>> and <<MongoDBAdapter>>.


queryStringStringin

MongoDB JSON query string.

In contrast to the MongoDB shell, the JSON keys must be quoted properly.

MongoDB query string as valid JSON
rowsAffectedIntegerout

Returns how many rows have been affected by the action.

This information may be unavailable depending on the acknowledgement settings on the <<MongoDBAlias>>. If the Runtime cannot retrieve this information, rowsAffected will be NULL.


MongoDB Adapter Parameter Types

MongoDBFindOptions

AttributeTypeDescriptionAllowed Values / Examples
limitIntegerLimits the number of returned documents.any integer between -231 and 231
skipIntegerSpecifies the number of documents to skip in the result set (counted from the beginning).any positive integer
projectionStringAn aggregation document that projects the results accordingly. It defines the final shape of the returned documents.valid JSON
sortStringA sort document.valid JSON

MongoDBHandle

AttributeTypeDescription
idIntegerID of the MongoDB handle.

MongoDBReplaceOptions

AttributeTypeDescriptionAllowed Values / Examples
upsertBooleanSpecifies if the document should be inserted if no document matches the query.

true

Insert document.
falseDo nothing.

MongoDBUpdateOptions

AttributeTypeDescriptionAllowed Values / Examples
upsertBooleanSpecifies if the document should be inserted if no document matches the querytrueInsert document.
falseDo nothing.
arrayFiltersArray of StringSets conditions for the filtered positional operators during the update.array of filter document as valid JSON strings

Related Documentation:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.