This Snap updates one or more documents in a MongoDB collection. It also supports the upsert capability.
Expected upstream Snaps: Any Snap with document output view
Expected downstream Snaps: Any Snap with document input view
Expected input: a map data to evaluate expression properties and/or to update documents in a MongoDB collection
Expected output:
{
"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.
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.
This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See MongoDB Account for information on setting up this type of account.
Views:
Input
This Snap has one document input view. Each input document produces one document at the output view or the error view.
Output
This Snap has one optional document output view.
Error
This Snap has at most one document error view and produces zero or more documents in the view.
Settings
Label
Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.
Database name
The database that the collection is defined in. If not specified, then the MongoDB account database will be used.
Example: assets
Default: [None]
Collection name
Required. Select or enter a MongoDB collection name.
Example: leads
Default: [None]
Update query
Required. The update query represents the update query parameter. It is an expression that evaluates to an object or JSON string. When the expression evaluates to an object, only strict mode is supported. When the expression evaluates to a JSON string, both strict mode and mongo shell mode are supported. More information about MongoDB Extended JSON can be found here.
Specifies the operation to be performed on the update query.
Example: $min
Default value: $set
Exclude list
Specifies the list of input fields that must be removed from the dataset before sending the dataset to MongoDB.
Example: $ranking
Default value: _id
Upsert
When selected, inserts a document from the input view if no document in the collection matches the update query criteria.
Default value:Not Selected
Update all that match
When selected, updates all documents in the collection that match the update query criteria, otherwise updates only one.
Default value: Selected
Pass through
If selected, the input document will be passed through to the output views under the key 'original'. The document will be passed to the Parameter output view, and it will also be passed to the Result Set output view if there is output sent from this view.
Default value: Selected
Snap execution
Select one of the three modes in which the Snap executes. Available options are:
Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.
Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.
Disabled: Disables the Snap and all Snaps that are downstream from it.
The upstream schema suggest is only supported if the defined collection provides data. MongoDB does not provide a metadata API to describe the collection, so the SnapLogic platform looks at the data and derives the schema from it
Examples
Example #1
In this example, we shall update the collection from an upstream Snap to the MongoDB table using the MongoDB Update Snap.
Using the JSON Generator Snap, we are passing the values to be updated to the MongoDB collections.
In the MongoDB Snap settings, we specify the collection name, Sample data, to be updated with the values just passed from the upstream JSON Generator Snap. The update query condition
"{field002:'"+$field002+"'}" is passed (with the expression enabled) to update the documents in the collection.
The successful execution of the pipeline displays the below output preview:
Example #2
This example pipeline performs the following tests:
deletes all documents in a collection
inserts three documents into the empty collection
updates two documents in the same collection
The pipeline is attached in the Downloads section below.
Added MongoDB Execute Snap to the MongoDB Snap Pack.
February 2024
main25112
Stable
Updated and certified against the current SnapLogic Platform release.
November 2023
main23721
Stable
Updated and certified against the current SnapLogic Platform release.
August 2023
main22460
Stable
Updated and certified against the current SnapLogic Platform release.
May 2023
main21015
Stable
Upgraded with the latest SnapLogic Platform release.
February 2023
main19844
Stable
Upgraded with the latest SnapLogic Platform release.
November 2022
main18944
Stable
Upgraded with the latest SnapLogic Platform release.
September 2022
430patches18223
Latest
TheMongoDB UpdateSnap in a low-latency feed Ultra Pipeline now correctly acknowledges the requests.
August 2022
430patches17472
Latest
The MongoDB Account with Encryption type set to TLS/SSL does not fail with the "URL cannot be null" error.
August 2022
main17386
Stable
Upgraded with the latest SnapLogic Platform release.
4.29Patches
429patches15807
Latest
Updated the expected output for the MongoDB - Update Snap that is changed due to the upgrade of Spring Core framework version.
4.29
main15993
Stable
Upgraded with the latest SnapLogic Platform release.
4.28
main14627
Stable
Upgraded with the latest SnapLogic Platform release.
4.27
main12833
Stable
Upgraded with the latest SnapLogic Platform release.
4.26
main11181
Stable
Upgraded with the latest SnapLogic Platform release.
4.25
main9554
Stable
Upgraded with the latest SnapLogic Platform release.
4.24
main8556
Stable
Fixes an issue in the MongoDB accounts to connect to Atlas Free Tier and Shared Cluster database using theUse cursor timeoutcheck box in the MongoDB cursor properties. If selected, this option enables the server to close a cursor automatically after a period of inactivity. For the existing accounts that does not have this field, the value for this check box returnsfalse, which is backward compatible.
4.23
main7430
Stable
Upgraded with the latest SnapLogic Platform release.
4.22
main6403
Stable
Upgraded with the latest SnapLogic Platform release.
4.21 Patch
421patches6272
Latest
Fixes the issue whereSnowflake SCD2Snap generates two output documents despite no changes toCause-historizationfieldswithDATE, TIME and TIMESTAMPSnowflake data types, and withIgnore unchanged rowsfield selected.
4.21 Patch
421patches6144
Latest
Fixes the following issues with DB Snaps:
The connection thread waits indefinitely causing the subsequent connection requests to become unresponsive.
Connection leaks occur during Pipeline execution.
4.21 Patch
MULTIPLE8841
Latest
Fixes the connection issue in Database Snaps by detecting and closing open connections after the Snap execution ends.
4.21
snapsmrc542
Stable
Upgraded with the latest SnapLogic Platform release.
4.20
snapsmrc535
Stable
Upgraded with the latest SnapLogic Platform release.
4.19
snaprsmrc528
Stable
Upgraded with the latest SnapLogic Platform release.
4.18
snapsmrc523
Stable
Added the following fields to the Mongo DB Find Snap: Projection Condition, Sort Condition, Offset, Limit, and Group result.
Added a new Snap, MongoDB Group, which enables you to group input documents by a specified expression, and output to the next stage, one document for each distinct grouping.
Added a new field to the Mongo DB Update Snap,Update operationandExclude list, which enable you to update operations and exclude a list of JSON properties before sending the updated documents to MongoDB.
4.17
ALL7402
Latest
Pushed automatic rebuild of the latest version of each Snap Pack to SnapLogic UAT and Elastic servers.
4.17 Patch
db/mongo7331
Latest
Fixed an issue with the MongoDB - Update Snap wherein the Snap converts all non-updated integer and float data types to string data type.
Fixed a Null Pointer Exception for old MongoDB accounts that did not have driver jars.
4.17
snapsmrc515
Latest
Added the Snap Execution field to all Standard-mode Snaps. In some Snaps, this field replaces the existing Execute during preview check box.
4.16
snapsmrc508
Stable
Upgraded with the latest SnapLogic Platform release.
4.15 Patch
db/mongo6783
Latest
Fixed connection timeout issue with MongoDB.
4.15 Patch
db/mongo6465
Latest
Fixed an issue wherein REST calls to Ultra tasks returned an error message.
4.15
snapsmrc500
Stable
Upgraded with the latest SnapLogic Platform release.
4.14 Patch
db/mongo5666
Latest
Fixed the Update, Delete, and Find Snaps to populate input view schema for a given table, similar to the Insert Snap.
4.14
snapsmrc490
Stable
Upgraded with the latest SnapLogic Platform release.
4.13 Patch
mongo5537
Latest
Fixed the Update, Delete, and Find Snaps to populate input view schema for a given table, similar to the Insert Snap.
4.13
snapsmrc486
Stable
Upgraded with the latest SnapLogic Platform release.
4.12
snapsmrc480
Stable
Added the SSl certification properties to all the MongoDB Accounts to ensure the validation of the certificate.
4.11
snapsmrc465
Stable
Upgraded with the latest SnapLogic Platform release.
4.10 Patch
mongo3978
Latest
Resolved an issue where the NumberFormatException was not handled properly for some of the valid Number Types like "NaN"/ "+Infinity"/ "-Infinity".
4.10
snapsmrc414
Stable
Upgraded with the latest SnapLogic Platform release.
4.9.0 Patch
mongodb3259
Latest
Addressed an issue in MongoDB Update where Upsert Date failed with "Can't find a codec for class org.joda.time".
MongoDB Insert Snap - Collectio name expression evaluate fixed.
4.9
snapsmrc405
Stable
Query Condition property is now an expression that evaluates to an object or JSON string.
Updated the Snap with Database nameproperty to support the users defined in an authentication database.
4.8.0 Patch
mongodb2735
Latest
Added SSL encryption type to all MongoDB accounts and Replica set Accounts and removed the MongoDB SSL account.
4.8
snapsmrc398
Stable
The MongoDB Delete Snap and MongoDB Update Snap were introduced in this release.
Enhanced the MongoDB Snap account with SSL Account type.
Updated the Batch Size property in MongoDB Find with the default value of 0.
Enhanced the MongoDB Find Snap documentation with an example.
Info tab added to accounts.
Database accounts now invalidate connection pools if account properties are modified and login attempts fail.
4.7 Patch
mongo2375
Latest
Update the MongoDB java driver to 3.0.4; Add exception handling to each record processing.
MongoDB SSL Account removed and replaced with the new configuration for all the Accounts (Encryption type Property).
4.7 Patch
mongo2338
Latest
Add an account for MongoDB SSL connection without certificates validation
4.7 Patch
mongo2200
Latest
Fixed an issue for database Select Snaps regarding Limit rows not supporting an empty string from a pipeline parameter.
4.7
snapsmrc382
Stable
Updated the Snap account with the LDAP Authentication type.
4.6
snapsmrc362
Stable
Resolved an issue in MongoDB Insert Snap that processed and inserted all numeric fields as strings.
4.5.1
snapsmrc344
Stable
Resolved and issue with MongoDB Insert with an empty input view failed.
Resolved an issue with MongoDB Insert that changed a numeric type field in MongoDB as String.
Resolved an issue that caused Snap execution failures when accessing MongoDB using a Replica Set account.
4.3.2
Stable
Resolved an issue with MongoDB Find returning nothing when nothing was found.
4.3
Stable
Resolved an issue with an incorrect resolution displaying during account validation if the username was blank.
Resolved an issue in the MongoDB Find Snap with nested arrays.
Resolved an issue in MongoDB Find with data not being usable be other Snaps.
4.2.2
Stable
Username and Password are no longer required fields when creating a MongoDB account since it is possible to configure an instance where that information is not required.
MongoDB account now supports Mongo Java Driver 3.0.2.
MongoDB Find
Resolved an issue with MongoDB Find not properly supporting the expression language.
Resolved an issue with MongoDB Find returning "Current context not an ARRAY but OBJECT" for a deep nested ObjectId object.
Resolved an issue with MongoDB Find when data had built in datatype.
Resolved a null pointer exception in MongoDB Find.
Resolved an issue with MongoDB Find not routing failed documents to the error view.
Resolved an issue with MongoDB error handling when maximum number of documents reached.
Improved the error message presented when MongoDB database could not reach the JCC.
4.2.1
Stable
MongoDB - Find: Resolved Error- Failure: java.util.HashMap cannot be cast to java.lang.String when in query condition passes without single quotes.
MongoDB - Find: Resolved failure with Query Using Operators.
Resolved MongoDB driver and account do not support current version of MongoDB.
Resolved a failure MongoDB Insert with custom _id.