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

MongoDB: Wrong results returned with MERGE in ONE-1-ONE relation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.7
    • 8.4
    • None

      If Schema is like

                  CREATE FOREIGN TABLE  Customer (
                      CustomerId integer PRIMARY KEY,
                      FirstName varchar(25),
                      LastName varchar(25)
                  ) OPTIONS(UPDATABLE 'TRUE');
                   
                  CREATE FOREIGN TABLE Address (
                      CustomerId integer PRIMARY KEY,
                      Street varchar(50),
                      City varchar(25),
                      State varchar(25),
                      Zipcode varchar(6),
                      FOREIGN KEY (CustomerId) REFERENCES Customer (CustomerId)
                   ) OPTIONS(UPDATABLE 'TRUE', "teiid_mongo:MERGE" 'Customer');
      

      and we did inserts like

      insert into Customer (customerId ,firstname,lastname) values ('1002','Syed','Iqbal');
      insert into Address (customerId,street,city,state,zipcode) values ('1002','123 Main St','Chicago','IL','60659');
      insert into Customer (customerId ,firstname,lastname) values ('1000','Ramesh','Reddy');
      

      the data in mongo is in form

      {
      	"Address" : {
      		"Street" : "123 Main St",
      		"City" : "Chicago",
      		"State" : "IL",
      		"Zipcode" : "60659",
      		"_id" : DBRef("Customer", 1002)
      	},
      	"FirstName" : "Syed",
      	"LastName" : "Iqbal",
      	"Notes" : [ ],
      	"_id" : 1002
      }
      { "_id" : 1000, "FirstName" : "Ramesh", "LastName" : "Reddy" }
      

      and if you issue

      SELECT * FROM Address
      

      you will see

      CustomerId Street City State
      1002 123 Main St Chicago IL
      <null> <null> <null> <null>

              rhn-engineering-rareddy Ramesh Reddy
              rhn-engineering-rareddy Ramesh Reddy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: