In this section:
Table of Contents | ||
---|---|---|
|
Introduction
The MongoDB Tool sends a query to a MongoDB database and returns the JSON-format results from that query. JSON tools such as JSON Data Banks and JSON Assertors can be added as "outputs" to MongoDB tools in order to display and/or validate the query results.
In this section:
Table of Contents | ||
---|---|---|
|
Requirements
- The following MongoDB versions are supported:
- 2.6
- 3.0
- 3.2
- 3.4
- 3.6
- 4.0
- 4.2
- 4.4
- This tool requires SOAtest/Virtualize 2020.1 or later.
...
The tool can be installed from the UI or the command line.
UI Installation
- Choose Parasoft> Preferences.
- Choose System Properties and click Add JARs.
- Browse to
- Go to Parasoft > Preferences and click System Properties.
- Click Add JARs and select the com.parasoft.soavirt.tool.mongodbtool.jar filejar file and click Open.
- Click Apply.
- Restart Apply the changes and restart SOAtest/Virtualize.
Command Line Installation
Add the com.parasoft.soavirt.tool.mongodbtool.jar file jar file to the system.properties.classpath property in your settings properties file. For example:
system.properties.classpath=<PATH_TO_JAR><path to jar>/com.parasoft.soavirt.tool.mongodbtool.jar
...
Scroll Table Layout | ||
---|---|---|
|
Hosts | Comma - separated list specifying the host(s) and port(s) of the MongoDB server(s) to query. If empty, the default value will be used. Default is Example:
|
---|---|
Use SSL | Specifies whether SSL should be used when connecting to the MongoDB server. If empty, the default value will be used. Default is false . |
Read Preference | Specifies the preference in which the tool reads operations to the members of a replica set. See the MongoDB documentation for additional information about read preference options. Default is |
...
Scroll Table Layout | ||
---|---|---|
|
Authentication Mechanism | Specifies Specify the authentication mechanism used to connect to the MongoDB server. The following values are acceptable:
|
---|---|
Username | Specifies the username with which to authenticate to a MongoDB database that uses authentication. |
Password | Specifies the password with which to authenticate to a MongoDB database that uses authentication. |
Authentication Database | Specifies the authentication database to use. If empty, the default value will be used. This setting is ignored when the authentication mechanism is set to LDAP . Default is admin . |
...
Database | Specifies the name of the MongoDB database to query. | ||
---|---|---|---|
Collection | Specifies the name of the MongoDB collection to query. | ||
Query | Specifies the query in the strict mode of the MongoDB Extended JSON language (see the MongoDB Documentation for details). If empty, the default value will be used. Default is all documents . | ||
Projection | Specifies the projection in the strict mode of the MongoDB Extended JSON language (see the MongoDB Documentation for details). If empty, the default value will be used. Default is all fields . | SortSpecifies the sort order in which the query returns matching documents in the strict mode of the MongoDB Extended JSON language (see the MongoDB Documentation for details). Only applicable when Operation is set to find . If empty, the default value will be used. Default is unsorted . | |
Limit | Specifies the maximum number of documents should returned by the query. Only applicable when Operation is set to find . If empty, the default value will be used. Default is 0 (no limit) . | ||
Skip | Specifies how may documents, starting from the first, that should be skipped before returning the result of the query. Only applicable when Operation is set to find . If empty, the default value will be used. Default is 0 (nothing skipped) . |
Update Settings
Anchor | ||||
---|---|---|---|---|
|
...
The following query returns all fields of product id 101 from the products collection.
...
The following query returns only the sku field for product id 101 from the products collection.
...
- Right-click the appropriate MongoDB Tool node and choose , then choose Add Output.
- In the Add Output dialog, choose a JSON tool in the right pane and click Finish.
After the MongoDB tool is executed, output will be passed to the chained tool. You You can then perform additional tool configuration as needed (for examplee.g., to specify assertions, extractions, and so onetc.).
Change Log
The following updates to this extensions extension were made.
1.3
- Added ability to insert, update, and delete MongoDB documents.
1.2
- Added support for MongoDB 4.0, 4.2, 4.4.
1.1
Added support for multiple hosts.
Note title Scripts that specify the host and/or port connection settings will not persist after upgrading the tool. The host and port connection settings have been merged into a single field. If you used a script to define your host and/or port connection, you will need to add a new script to configure these settings in the Hosts field after upgrading to this version. See Connection Settings for additional information.
- Added support outputting results as traffic.
- Added support for read preference configuration.
...