0

我在 MongoDB 中有以下文档:

{
    "_id" : ObjectId("529632350083bc14d145bb56"),
    "CaseId" : "8f68cf65-80ad-4950-88d5-e322d0296461",
    "CaseAddressString" : "527 Irving Avenue, Rivereno",
    "CaseOpenDatetime" : ISODate("2013-11-22T17:54:50.198Z"),
    "CaseBeginDatetime" : ISODate("2013-11-19T17:54:50.198Z"),
    "CaseDescription" : "Veniam deserunt nisi pariatur non commodo pariatur in.",
    "RequestorFirstName" : "Morgan",
    "RequestorLastName" : "Nunez",
    "age" : 41,
    "gender" : "female",
    "CasePhoneNumbers" : [
        {
            "type" : "home",
            "number" : "+1 (976) 478-2278"
        },
        {
            "type" : "fax",
            "number" : "+1 (801) 463-3144"
        }
    ],
    "location" : [
        -122.394372,
        37.765385
    ],
    "CaseLat" : 37.727456,
    "CaseLong" : -122.416738,
    "ServiceName" : "Missing Sign",
    "CaseCurrentStatusDatetime" : ISODate("0NaN-NaN-NaNTNaN:NaN:NaNZ")
}

数组让CasePhoneNumbers我有些头疼。我正在尝试构建一个可以与 Teiid 一起使用的模式文件。我已经构建了以下内容,它在我的项目中运行良好。现在要插入最后一部分,我很茫然。

CREATE FOREIGN TABLE cases(
    id varchar(50) PRIMARY KEY,
    CaseId varchar(50),
    CaseAddressString varchar(50),
    CaseOpenDatetime date,
    CaseBeginDatetime date,
    CaseDescription varchar(200),
    RequestorFirstName varchar(50),
    RequestorLastName varchar(50),
    CaseCurrentStatus varchar(25),
    age integer,
    gender varchar(20),
    CaseLat float,
    CaseLong float,
    ServiceName varchar(50)
) 
    OPTIONS(UPDATABLE 'TRUE');
4

2 回答 2

0

你可以做

CREATE FOREIGN TABLE cases(
    id varchar(50) PRIMARY KEY,
    CaseId varchar(50),
    CaseAddressString varchar(50),
    CaseOpenDatetime date,
    CaseBeginDatetime date,
    CaseDescription varchar(200),
    RequestorFirstName varchar(50),
    RequestorLastName varchar(50),
    CaseCurrentStatus varchar(25),
    age integer,
    gender varchar(20),
    CaseLat float,
    CaseLong float,
    ServiceName varchar(50)
) OPTIONS(UPDATABLE 'TRUE');

CREATE FOREIGN TABLE CasePhoneNumbers (
     caseid varchar,
     type string,
     number string,
     FOREIGN KEY (caseid) REFERENCES cases (_id)
) OPTIONS(UPDATABLE 'TRUE', "teiid_mongo:MERGE" 'cases')

您可以在https://docs.jboss.org/author/display/TEIID/MongoDB+Translator看到更多文档

https://issues.jboss.org/browse/TEIID-3040删除了详细的 IDREF 字段,但这将在 Teiid 8.9 中

于 2014-08-01T15:17:30.790 回答
0

不确定是否相关,我在控制台上看到以下警告消息:

WARN 11524 --- [main] org.teiid.CONNECTOR: TEIID30003 Without required support 
property TableAlias, pushdown will not be enabled for SelfJoins on translator 
[mongodb, raasagent].

“raasagent”是我在 DataSources.java 中定义的 MongoDBConnectionFactory bean。

鉴于 MongoDB matrix_variable 集合中的以下文档:

{
    "_id" : ObjectId("5b2367c9c9e77c0007ca0111"),
    "createdOn" : ISODate("2018-06-15T07:16:25.459Z"),
    "modifiedOn" : ISODate("2018-07-02T02:04:16.661Z"),
    "variableId" : "183cf101d2334ac09bd0db9aee96081f",
    "name" : "lfzq_test",
    "description" : "",
    "lastModifiedUserEmail" : "admin1@abc.com",
    "headerRow" : {
        "rowId" : "0b002942a5b4424f98fcc270af0290c3",
        "values" : [ 
            "name", 
            "value"
        ],
        "isEncrypted" : [ 
            false, 
            true
        ]
    },
    "rows" : [ 
        {
            "rowId" : "940467f9bb724d1688086baeec05049b",
            "values" : [ 
                "lfzq123q", 
                "751c634ca5e24102a00800b386955a5c"
            ]
        }
    ],
    "deleted" : false
}

“headerRow”属性在 OData 架构中作为单独的实体类型公开,而不是“rows”属性。

我发现了以下带有 odata/$metadata 的实体类型:

<EntityType Name="headerRow">...</EntityType>
<EntityType Name="matrix_variable">...</EntityType>

希望它足够清楚。任何线索为什么“行”属性不通过 OData 公开?

于 2019-12-18T03:41:52.917 回答