Breadcrumbs

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.




There were errors rendering macro:

  • An unknown error occurred.


<<MongoDBAdapter>>


Tagged Value

Description

Allowed 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.

insert

Insert a new document.

find

Find a document.

aggregate

Execute an aggregation operation.

fetch

Fetch the next document from a result set.

update

Update a document.

replace

Replace a document.

delete

Delete a document.


MongoDB Adapter Parameters

Action "find"


Name

Type

Direction

Description

Allowed Values / Examples

database

String

in


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



collection

String

in


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



options

MongoDBFindOptions

in

MongoDB options for find.


queryString

String

in


MongoDB JSON query string.

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


MongoDB query string as valid JSON

handle

MongoDBHandle

out

Handle 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 "fetch"


Name

Type

Direction

Description

handle

MongoDBHandle

in

Handle to a result set that has been created by a find action.

result

String

Resulting document in JSON format.

out

Fetched 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"


Name

Type

Direction

Description

database

String

in

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

collection

String

in


Error rendering macro 'multiexcerpt-include' : Page loading failed


pipeline

Array of String

in

Pipeline you want to use with aggregation.


Error rendering macro 'multiexcerpt' : Page loading failed


handle

MongoDBHandle

out

Handle 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


Error rendering macro 'multiexcerpt-include' : Page loading failed


Array of <document class>

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


Action "insert"


Name

Type

Direction

Description

database

String

in

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

collection

String

in

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

document

<document class>

in

A data structure representing the document you want to insert. The data structure will be serialized.

documents

Array of <document class>

in

Array 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"


Name

Type

Direction

Description

Allowed Values / Examples

database

String

in

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


collection

String

in

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


pipeline

Array of String

in

Pipeline you want to use with update.

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


options

MongoDBUpdateOptions

in

MongoDB options for update.


nullifications

Array of String

in

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.addresscustomer.address.streetcustomer.phoneArray.$[elem].number

removals

Array of String

in

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.addresscustomer.address.streetcustomer.phoneArray.$[elem].number

queryString

String

in

MongoDB JSON query string.

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

MongoDB query string as valid JSON

document

Any <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



updateString

String

in

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"     }}

rowsAffected

Integer

out


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"


There were errors rendering macro:

  • An unknown error occurred.


Action "delete"


Name

Type

Direction

Description

Allowed Values / Examples

database

String

in


Error rendering macro 'multiexcerpt-include' : Page loading failed



collection

String

in

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


queryString

String

in

MongoDB JSON query string.

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

MongoDB query string as valid JSON

rowsAffected

Integer

out

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

Attribute

Type

Description

Allowed Values / Examples

limit

Integer

Limits the number of returned documents.

any integer between -231 and 231

skip

Integer

Specifies the number of documents to skip in the result set (counted from the beginning).

any positive integer

projection

String

An aggregation document that projects the results accordingly. It defines the final shape of the returned documents.

valid JSON

sort

String

A sort document.

valid JSON

MongoDBHandle

Attribute

Type

Description

id

Integer

ID of the MongoDB handle.

MongoDBReplaceOptions

Attribute

Type

Description

Allowed Values / Examples

upsert

Boolean

Specifies if the document should be inserted if no document matches the query.

true

Insert document.

false

Do nothing.

MongoDBUpdateOptions

Attribute

Type

Description

Allowed Values / Examples

upsert

Boolean

Specifies if the document should be inserted if no document matches the query

true

Insert document.

false

Do nothing.

arrayFilters

Array of String

Sets conditions for the filtered positional operators during the update.

array of filter document as valid JSON strings


Related Documentation: