Nested MERGES are not supported feature yet, there is JIRA logged for this feature [TEIID-2561] Allow nested MERGE of entities in MongoDB translators - JBoss Issue Tracker
I know I have written some support for it, but later retracted to focus more on other features. It can get quite complex in terms of generating queries for MongoDB. I do not know, if I would have enough time in 8.10 time frame, but if you want submit a patch I am willing take a look.
Thanks Ramesh, is there a current workaround for this at the moment? I'm not sure how I would write a patch for this ATM.
Since both Sample and SQS1 are both joined as through "record_id", you can make them sibling documents, or combine into single table. However, it will not give the JSON structure you shown above.
the record_id join was just what was done in one of the examples. I am happy to try another way to translate the document structure. What would be an example of flattening out the embedded structure of sample and SQS1? Thanks!
What would be an example of flattening out the embedded structure of sample and SQS1? Thanks!
Define as single table?
How would I do this in the translator since they are embedded? Thanks!
Are using the (a) existing document structure in MongoDB or you are (b) creating a new document structure with Teiid. With (a) there is no good workaround currently, you can possibly treat the sub-document as an object or clob, with (b) you can define the table structure in the VDB like examples in the documentation, for example
- CREATE FOREIGN TABLE SQS1 (
- record_id varchar(100) PRIMARY KEY,
- score double,
- threshold varchar(100),
- pass boolean,
- FOREIGN KEY (record_id) REFERENCES sample (record_id)
- ) OPTIONS(UPDATABLE 'FALSE', "teiid_mongo:MERGE" 'records');