Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-3040

MongoDB: Remove the IDREF fields for the FK fields

    Details

    • Type: Enhancement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 8.7.1, 8.9
    • Component/s: None
    • Labels:
      None

      Description

      TEIID-2958 has been working towards removing the IDREF fields from embedded documents. I see no reason to represent FK in the parent table with IDREF either. This will make the document model representation simple and aligns with how a typical developer would design.

      If the schema looks like

      CREATE FOREIGN TABLE Customer (
        id integer PRIMARY KEY,
        firstName string,
        lastName string,
        email_addr string,
       FORIEGN KEY (email_addr) REFERENCES Email(address)
      );
      
      CREATE FOREIGN TABLE Email (
         address string PRIMARY KEY,
         provider string
      ) OPTIONS ("teiid_mongo:MERGE" 'Customer');
      

      Currently Teiid writes the document as

      Customer
      {
      	"_id" : 1,
      	"firstName" : "Ramesh",
      	"lastName" : "Reddy",
      	"email_addr" : DBRef("EMail", "abc@abc.com"),
      	"EMail" : {
                       "_id": "abc@abc.com",
      		"provider" : "Comcast"
      	}
      }
      

      change to:

      customer
      {
      	"_id" : 1,
      	"firstName" : "Ramesh",
      	"lastName" : "Reddy",
      	"email_addr" :  "abc@abc.com",
      	"EMail" : {
      		"provider" : "Comcast"
      	}
      }
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                rareddy Ramesh Reddy
                Reporter:
                rareddy Ramesh Reddy
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: