MongoDB Command
Runs a MongoDB command and retrieves the response
Processing
For every input row, the step executes a MongoDB Command and provides the response in step results.
Settings
| Name | Type | Description |
|---|---|---|
Connection |
dict |
The database connection to use. Evaluated for each input row |
Database |
string |
The database to run the command against. Evaluated for each input row |
Command |
string or dict |
The command to execute. This value is converted to a BSON document, then run as a command.
Evaluated for each input row |
BSON conversion
Values and BSON are converted as per the following table:
| Value Type | Bson Type |
|---|---|
| boolean | bool |
| long | int or long |
| double | double |
| decimal | decimal |
| datetime | date |
| string | string |
| binary | binary |
| list | array |
| dict | object |
Dicts of the form {'$oid' string} are converted to BSON ObjectIds and vice versa.
Function values cannot be converted to BSON.
Note:
Converting a dict to BSON generally results in an unspecified key order in the BSON object.
If the order of keys is important, you can supply a specially constructed dict of the form:
{
:__bson [
[key1, value1],
[key2, value2],
...
]
}
Such dicts are converted to a BSON object with the order of key-value pairs preserved:
{
key1: value1,
key2: value2,
...
}
You can use the BSON widget to generate such dicts in the UI.
Results
| Name | Type | Description |
|---|---|---|
response |
dict | Dict holding the MongoDB response to the command. |
success |
boolean |
true if the response contains key "ok" with value 1, false otherwise |