You can use the MongoDB adapter to interact with a MongoDB and to insert, get and manipulate documents.
MongoDBAdapter_CustomerData_Example
Click the icon to download a simple example model that shows the usage of the MongoDB adapter in Scheer PASDesigner.
Inserting Documents
Using one of the insert operations, you can insert one or more documents into a MongoDB.
The MongoDB adapter comes with two insert operations: one to insert a single document, the other to insert multiple documents at once.
Name
Type
Description
document
<document class>
A single object of an xUML class representing the document structure.
documents
Array of <document class>
An array of objects of an xUML class representing the document structure.
Refer to the reference of the insert operations for a detailed description of all parameters and options.
Deleting Documents
Using the delete operation, you can remove one or more documents from a MongoDB.
For all actions that refer to existing documents, you need to provide a query string (queryString) to identify them. A query string contains all properties of the document you want to use for selection.
Assume we have the following sample Customer document structure:
The simplest way to create a query string is the following:
Create an object having the structure of the document (Customer in the example).
create queryData;
Set all query values to this object (the customerIDin the example).
set queryData.id = customerID;
Provide this object as queryString by converting it to JSON using classToExtendedJSON().
set queryString = queryData.classToExtendedJSON();
To build a query string, we recommend to not use concat() operations but to create a data structure that represents the update string and can be converted to JSON with classToExtendedJSON().
Building a query string manually (e.g. using concat()) is susceptible to code injection.
You can remove all documents from the collection by providing {} as queryString.
Refer to reference of the delete operations for a detailed description of all other parameters and options.