什麼工作:
在微風我可以執行此查詢:微風和OData的:麻煩不斷擴大集合
Q1
breeze.EntityQuery.from('accounts').where('id', 'eq', account_id)
導致這個請求:
R1
http://localhost:8000/odata/findash.svc/accounts
?$filter=id eq 'NTE5M2UxMzQzMmY3MDAxYzE1MDAwMDAx'
返回除了正確的數據的事務屬性看起來是這樣的:
transactions: {
__deferred: {
uri: "http://localhost:8000/odata/findash.svc/accounts('NTE5M2UxMzQzMmY3MDAxYzE1MDAwMDAx')/transactions"
}
}
我試着打了URI在交易.__ deferred.uri在瀏覽器中
R1.1
http://localhost:8000/odata/findash.svc/
accounts('NTE5M2UxMzQzMmY3MDAxYzE1MDAwMDAx')/transactions
它確實響應我期望的事務。
什麼不起作用:
,試圖讓該交易名單通過微風我改變,象這樣的擴展條款上面的查詢:
Q2
breeze.EntityQuery.from('accounts')
.where('id', 'eq', account_id).expand('transactions')
這結果請求:
R2
http://localhost:8000/odata/findash.svc/accounts
?$filter=id eq 'NTE5M2UxMzQzMmY3MDAxYzE1MDAwMDAx'&$expand=transactions
它會產生500錯誤。
我還試圖此微風查詢:
Q3
breeze.EntityQuery.from('transactions')
.expand('account').where('account.id', 'eq', account_id)
這也產生一個500錯誤。
我需要知道:
我試圖排除微風之前,我潛入這是建立在節點+的MongoDB + JayData的OData服務。
上面的R1和R2之間的唯一區別是&$expand=transactions
的添加。 R1工作和R2導致500錯誤。如果R2是一個有效的OData請求,那麼我需要將我的故障排除工作集中在JayData的實現上。麻煩對我來說,我是新的微風,OData & JayData,所以我無法縮小我的搜索範圍。
僅供參考,我的JayData上下文。js在這裏:
$data.Class.define("$findash.Types.Account", $data.Entity, null, {
id: { type: "id", key: true, computed: true },
name: { type: "string" },
status: { type: "string" },
notes: { type: "string" },
transactions: { type: "Array", elementType: "$findash.Types.Transaction", inverseProperty: "account" }
}, null);
$data.Class.define("$findash.Types.Transaction", $data.Entity, null, {
id: { type: "id", key: true, computed: true },
account: { type: "$findash.Types.Account", inverseProperty: "transactions" },
payee: { type: "string" },
memo: { type: "string" },
amount: { type: "int" }
}, null);
$data.Class.define("$findash.Types.FinanceContext", $data.EntityContext, null, {
accounts: { type: $data.EntitySet, elementType: $findash.Types.Account },
transactions: { type: $data.EntitySet, elementType: $findash.Types.Transaction }
}, null);
$findash.Types.FinanceContext.generateTestData = function (context, callBack) {
context.accounts.add(new $findash.Types.Account({
name: 'Checking',
status: 'Active',
notes: '<p>Notes lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus mauris quam, elementum in tincidunt id, mollis eget urna. Nulla fermentum est id risus venenatis malesuada. Quisque sed ipsum at nisl malesuada dictum vitae nec libero.</p><p>Aenean consectetur, purus eu semper feugiat, purus lacus semper nibh, at luctus ipsum metus non justo. Donec justo mi, rutrum a scelerisque sed, feugiat vel quam. Etiam justo nisi, vehicula ac congue vitae, ultricies non quam. Aliquam a velit in mauris luctus elementum. Praesent sollicitudin quam mattis velit sodales vitae feugiat felis volutpat.</p>',
transactions: [
new $findash.Types.Transaction({
payee: 'Shell Gas',
memo: 'Checkcard Transaction',
amount: -3500
}),
new $findash.Types.Transaction({
payee: 'Kroger',
memo: 'Checkcard Transaction',
amount: -9000
}),
new $findash.Types.Transaction({
payee: 'Papa Murphy\'s',
memo: 'Checkcard Transaction',
amount: -1500
})
]
}));
context.accounts.add(new $findash.Types.Account({
name: 'Savings'
}));
context.accounts.add(new $findash.Types.Account({
name: 'Power Company'
}));
context.accounts.add(new $findash.Types.Account({
name: 'Gas Company'
}));
context.accounts.add(new $findash.Types.Account({
name: 'Cable Company'
}));
context.accounts.add(new $findash.Types.Account({
name: 'Water Company'
}));
context.accounts.add(new $findash.Types.Account({
name: 'Trash Service'
}));
context.saveChanges(function (count) {
if (callBack) {
callBack(count);
}
});
};
module.exports = exports = $findash.Types.FinanceContext;
我更新了原來的問題。 –
您是否嘗試過沒有Breeze的OData調用?你確定JayData支持OData「擴展」嗎? –
嗨,我來自JayData的創建者JayStack。 JayData服務器僅支持使用Pro mongodb驅動程序進行擴展。 Pro驅動程序可以免費用於非商業用途,也可以用於商業用途的免費軟件。它的成本爲250美元,但提供其他不錯的功能,不僅導航,而且還包括地理搜索,索引處理和專業支持。 –