MongoDB adapter commands
Use MongoDB adapter commands on input and output cards or GET and PUT functions to configure the adapter to create, read, update, and delete single or multiple JSON documents in a MongoDB database.
MongoDB adapter command alias
Input source override execution command | -IAMONGOcard_num |
Output target override execution command | -OAMONGOcard_num |
Adapter commands
- -HOST {hostname | MongoDB_URI}
- -H {hostname | MongoDB_URI}
-
The host name or MongoDB URI (for example, mongodb://localhost:27017/) of the MongoDB server.
When you use the MongoDB URI, you can specify additional options for MongoDB client communication, such as enabling the client to use security based on certificates. Also, you can secure the user ID and password by using resource aliases for the -USER and -PSWD commands, and specify the $user and $pswd tokens on the URI. The user ID and password are dynamically resolved in the MongoDB URI during map execution.
This command is optional. If omitted, the default server is localhost.
- -PORT port_num
- -P port_num
-
The port number of the MongoDB server. This command is optional. If omitted, the default port number is 27017.
The -PORT command is ignored when you specify a MongoDB URI on the -HOST command.
- -DATABASE db_name
- -DB db_name
-
The name of the database on the MongoDB server.
- -USER userID
- -U userID
-
The user name or identifier that authenticates to the MongoDB server. Omit this keyword if user security is disabled on the server for connectivity.
- -PASSWORD pwd
- -PSWD pwd
-
The password of the user that authenticates to the MongoDB server. Omit this keyword if user security is disabled on the server for connectivity.
- -COLLECTION collection_name
- -C collection_name
-
The name of the MongoDB collection in the database to operate on.
- -QUERY {"query_text" | file_URL}
- -Q {"query_text" | file_URL}
-
The text of the JSON query that selects the documents to operate on, or the URL of a file that contains the query (for example, file://C:/myjsonquery.txt). If the query contains spaces, enclose it in quotation marks. A relative URL is relative to the map directory.
- -QTY
- Specifies the number of documents that the adapter is to retrieve. In burst mode, the total number of documents that the adapter retrieves does not exceed the number specified by the -QTY command, although a single burst might return fewer documents. The -QTY command is optional. If you omit it, the default number of documents is 1.
- -LSN
- Specifies the amount of time, in seconds, that the adapter waits for a document to arrive. This
command is optional. If you omit it, the adapter waits for an infinite amount of time. If a document
does not arrive within the specified time frame:
- In Command Server mode, the adapter returns a warning.
- -NOW
-
Commits the transaction immediately instead of as defined by the Transaction Scope setting on the input or output card.
- -SDF
-
Indicates that the JSON document is in single document format, rather than an array of documents. When you specify -SDF:
- A GET transaction returns only one document to the map, even when the adapter gets multiple documents.
- A PUT transaction writes only one document to the collection in the database.
- -UPDATE
-
- Updates the documents that match the query with the data in the third argument of the GET function, then returns the documents to the map for further processing.
- Updates the documents that match the query with either the data in the output card or the data in the third argument of the PUT function, then adds the documents to the collection.
- -DELETE
-
Deletes the documents that match the query from the collection.
- -T [E | V] [+] file_path
-
The adapter trace level and full path to the adapter trace log.
- -T
- Log adapter informational messages.
- -TE
- Log only adapter errors during map execution.
- -TV
- Use verbose (debug) logging. The log file records all activity that occurs while the adapter is fetching or inserting documents.
- +
- Append the trace information to the existing log file. Omit this keyword to create a new log file.