How to do complex document from three tables in json to mongodb using Pentaho
To insert into a Mongodb using PDI step MONGODB OUTPUT, the trick is in the 'Mongo Document Path' column. Put a bracket []
in the end of the field path where you want the array (See the data.labels[].id
in below screenshot), and use $set
as modifier operation.
You can also use a pointer if you want the data into a specific array. Use [n]
at the end of field path (see the tags[0]
, tags[1]
, tags[2]
in below screenshot). Note that the first array begins as 0.