5.22.77. Upload JSON documents to a MongoDB Server

<< Click to Display Table of Contents >>

Navigation:  5. Detailed description of the Actions > 5.22. Cloud services >

5.22.77. Upload JSON documents to a MongoDB Server

 

Icon: clip1109

 

Function: MongoDBWrite

 

Property window:

 

clip1110

 

Short description:

 

Upload JSON documents to a MongoDB Server.

 

Long Description:

 

Before using this Action, you need to install the Additional Components that runs the MongoDB connection: click on the link in the parameter P13. As soon as you defined the parameter P1, Anatella automatically fills-in the combo box for the parameters P2 and P3.

 

The option “upsert” parameter P4 means that MongoDB will try to update a document with new values coming from Anatella and if the document does not exist yet, MondoDB will perform an “insert” instead of an “update”. The document to update/delete is identified using it’s “Object ID”. The “Object ID’s” of the document to update/delete can be specified using the parameter P5. Most of the time, the parameter P5 is the column “Object ID” received from the MongoDBRead action (described in the previous section 5.22.76).

 
Depending on which parameter is selected amongst the parameters P6 to P9, there are 4 different ways to generate the different JSON documents that are sent to MondoDB:

 

Create a JSON document using all columns (Parameter P6 is selected)
 
Here is an example:
 
clip1111

 

The above graph inserts inside the MongoDB database the following 2 JSON documents:
 
clip1112

 

Create a JSON document using some columns (Parameter P7 is selected)
 
Here is an example:
 
clip1113
 
The above graph inserts inside the MongoDB database the following 2 JSON documents:
 
clip1114
 

Use the JSON document inside the columns (Parameter P8 is selected)
 
Here is an example:
 
clip1115
 
The above graph inserts inside the MongoDB database the following 2 JSON documents:
 
clip1116
 

Use a set of complex free-form JSON operations stored inside the column (Parameter P9 is selected)
 
Here is an example:
 
clip1117
 
The above Anatella graph updates the document with the oid=54651022bffebc03098b4567 inside the MongoDB database. More precisely, this document is updated so that:
 

It contains the fields “age” and “sex”.
 
Furthermore, these 2 fields values are set, respectively, to 50 and “M”.
 
clip1118
 

It does not contain the field “foo” anymore.

 

The documentation that explains the syntax of the JSON string that contains the different operations to perfom is here:
 

https://docs.mongodb.com/manual/reference/operator/update-field/