Adapter properties and commands

This section lists the properties and commands supported by the adapter.

Host

Specifies the MongoDB host name or connection URI string for connecting to MongoDB. For example, mongodb://localhost:27017/testdb.

When you use the connection URI string format, you can include any connection string options supported by the MongoDB driver for the MongoDB connections. You can also specify $user and $pswd placeholders for the user and password values, in which case they are then dynamically resolved at runtime from the User and Password property values. This is an optional property. If omitted, the default server is localhost, the default port is 27017 and the default authentication database is admin.

This is a mandatory property. The corresponding adapter command is -H host/uri (or -HOST host/uri).

Port

Specifies the port number on which the MongoDB server is listening for client connection. This is an optional property. If omitted, the default port number 27017 is used. This property is ignored if you specify a URI string for the Host property. The corresponding adapter command is -P port (or -PORT port).

Database

Specifies the name of the database on the MongoDB server that contains the collection specified in the Collection property, and on which to perform the configured fetch, insert, update, and delete operations. The corresponding adapter command is -DB database (or -DATABASE database).

Auth Database

Specifies the name of the database on the MongoDB server to use for authenticating the user. If not specified, the admin database is used by default. The corresponding adapter command is -AUTHDB database (or -AUTHDATABASE database).

User

Specifies the user name to use for authenticating with the MongoDB server. The user must exist in the specified authentication database. It should be omitted if user security is disabled on the server. The corresponding adapter command is -U user (or -USER user).

Password

Specifies the password to use for authenticating with the MongoDB server. It should be omitted if user security is disabled on the server. The corresponding adapter command is -P password (or -PSWD password).

Collection

Specifies the name of the MongoDB collection in the specified database. The fetch, insert, update, and delete operations configured in the adapter are performed on that collection. The corresponding adapter command is -C collection(or -COLLECTIONcollection).

Query

Specifies the text of the JSON query that selects the documents to operate on, or the URL of a file that contains the query text. For example, file://C:/myjsonquery.txt. If the query text contains spaces, enclose it in quotation marks. A relative URL is relative to the directory containing the compiled map or flow. The corresponding adapter command is -Q query/url(or -QUERYquery/url).

Quantity

Specifies the number of documents for the adapter to retrieve in Burst mode. The total number of documents that the adapter retrieves does not exceed the number specified in this property, although a single burst might return fewer documents. This is an optional property. The default value is 1. The corresponding adapter command is -QTY quantity

Fetch Unit

Specifies the number of documents for the adapter to retrieve per burst in Burst mode. The number of documents that the adapter retrieves per burst does not exceed the number specified in this property, although a single burst might return fewer documents. This is an optional property. The default value is 0 indicating that all documents should be retrieved in a single burst. There is no adapter command that corresponds to this property, the value is embedded directly into the underlying input card

Limit

Specifies a limit on the number of documents the adapter returns even if additional documents are available. If this property is specified along with the Quantity property, the adapter will utilize the lesser of the two values. The corresponding adapter command is -LIM limit(or -LIMITlimit).

Listen

Specifies the time duration in seconds for which the adapter awaits the arrival of a document. This property remains hidden, and the -LSN 0 command is automatically incorporated into the generated command line for the input card or source node. However, when manually defining the command line, as in a GET map rule, it is essential to include the -LSN 0 command. The corresponding adapter command is -LSN seconds

Commit Immediately

Specifies that each target operation is committed immediately, ignoring any Transaction settings set for the card or node. The corresponding adapter command is -NOW.

Single Document format

Specifies that the output from the fetch operation and the input for the insert operation is a single JSON document, as opposed to a JSON array of JSON documents. The corresponding adapter command is -SDF.

Update

Specifies that the adapter is to execute an update operation on the collection. The Query property defines the subset of collections on which the update operation is to be applied, and the input data supplied to the adapter represents the update document defining the operation to perform.

When specified in a three-argument GET map rule, the rule returns the results of the specified query after the update. The corresponding adapter command is -UPDATE.

Delete

Specifies the deletion of documents that align with the query outlined in the Query property. The corresponding adapter command is -DELETE

Logging

Specifies the level of logging to use for the log (trace) file produced by the adapter.

The value Information means log informational messages, the value Errors Only means log error messages only, and the value Verbose means log debug and trace level messages along with the informational and error messages.

The corresponding adapter command is:

-T[V|E][+] [log_file]

-TRACE[VERBOSE|ERROR][+] [log_file]

-T -> Log adapter informational messages.

-TE -> Log only adapter errors.

-TV -> Use verbose (debug) logging. The log file records all activity that occurs while the adapter is producing or consuming messages.

+ -> Appends the trace information to the existing log file. Omit this argument to create a new log file.

log_file -> Specifies the location of the log file to which to write log messages. If not specified, the default log file name m4mongo.mtr is used and the file is stored to the directory in which the executed compiled map resides.

Append Log

Flag indicating what to do if the specified log file already exists. When set to true, the log messages are appended to the file. When set to false, the file is truncated, and the messages are written to the empty file. The default value is False.

Log File Path

Specifies the location of the log file to which to write log messages. If not specified, the default log file name m4mongo.mtr is used and the file is stored to the directory in which the executed compiled map resides.