How to make a complex three-table document in json to mongodb using Pentaho

I have three tables in one database. These tables have a foreign key between them. Table 1 is the master of Table 2, and Table 2 is the master of Table 3.

I want to get data values ​​and convert in a MongoDB document as follows:

{
    "_id" : ObjectId("cf3977abf592d19962ff7982"),
    "T1Column1" : "Lorem Ipsum",
    "T1Column2" : ISODate("2015-11-27T16:04:24.000Z"),
    "Table2" : [ 
        {
            "T2Column1" : NumberLong(1),
            "T2Column2" : "Lorem Ipsum",
            "Table3" : [ 
                {
                    "T3Column1" : "Lorem Ipsum",
                    "T3Column2" : "Lorem Ipsum"
                }, 
                {
                    "T3Column1" : "Lorem Ipsum",
                    "T3Column2" : "Lorem Ipsum"
                }
            ]
        }, 
        {
            "T2Column1" : NumberLong(2),
            "T2Column2" : "Lorem Ipsum",
            "Table3" : [ 
                {
                    "T3Column1" : "Lorem Ipsum1",
                    "T3Column2" : "Lorem Ipsum"
                }, 
                {
                    "T3Column1" : "Lorem Ipsum2",
                    "T3Column2" : "Lorem Ipsum"
                }
            ]
        }
    ]
}

I'm already trying to use the β€œMongo document path” at the MongoDB output stage, but it is not possible to use β€œupsert” for subdocuments, as we can see in the MongoDB Ouput Document : enter image description here

How can I do this using Pentaho Data Integration (PDI)?

+4
source share
2

"$ addToSet"

enter image description here

+3

Mongodb, PDI MONGODB OUTPUT, " ". [] , (. data.labels[].id ) $set .

, , . [n] (. tags[0], tags[1], tags[2]). , 0.

enter image description here

+3

Source: https://habr.com/ru/post/1622930/


All Articles