...
Limitations and Known Issues
None.
Snap Views
Type | Format | Number of Views | Examples of Upstream and Downstream Snaps | Description |
---|
Input | Document | | Any Snap with document output view. | A map data to evaluate expression properties and/or to update documents in a MongoDB collection. Each input document produces one document at the output view or the error view. |
Output | Document | | Any Snap with document input view. | Paste code macro |
---|
| {
"updatedDocuments": n,
"matchedDocuments": m,
"updateOfExisting": [true or false],
"inserted": [true or false],
"original": {input document}
} |
In the above output: updatedDocuments - is the number of MongoDB documents that are changed in the update query. The updateOfExisting is true if updatedDocuments is greater than 0.
matchedDocuments - is the number of MongoDB documents that match the query for potential change.
updateOfExisting - is true if there are any updatedDocuments , otherwise, false.
For example, if the existing documents are:
Paste code macro |
---|
| {
"name": "Ralph",
"color": "blue",
"available": true
}
{
"name": "Sally",
"color": "blue",
"available": false
} |
And an update with query{} and input document of: Paste code macro |
---|
| {
"available": true
} |
then the result will be as follows: Paste code macro |
---|
| {
"updatedDocuments": 1,
"matchedDocuments": 2,
"updateOfExisting": true,
"inserted": false,
"original": {
{
"available": true
}
}
} |
Info |
---|
Before introducing the matchedDocuments definition, the updateOfExisting would be true if matchedDocuments was greater than 0. Now, updateOfExisting is true if updatedDocuments is greater than 0. The updateOfExisting output documents would be false if the update query matched documents, but didn’t update documents.
|
|
Error | Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are: Stop Pipeline Execution: Stops the current pipeline execution when the Snap encounters an error. Discard Error Data and Continue: Ignores the error, discards that record, and continues with the rest of the records. Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.
Learn more about Error handling in Pipelines. |
Snap Settings
Info |
---|
Asterisk (*): Indicates a mandatory field. Suggestion icon (): Indicates a list that is dynamically populated based on the configuration. Expression icon (): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic. Add icon (): Indicates that you can add fields in the field set. Remove icon (): Indicates that you can remove fields from the field set.
|
...
This example pipeline below demonstrates how to use the Array filters field to update records with filter conditions.
...
Download this pipeline.
Step 1: Configure the MongoDB - Find Snap to search for all the records with record id =1.
...