0

我嘗試通過日期範圍通過GQL和JSON API在Google數據存儲中查找對象。 例如,這是我的要求:Google JSON API和GQL。按日期範圍獲取對象

SELECT * FROM table WHERE uuid = "test" AND start >= 100 AND end <= 150 

,但我得到的錯誤:

{ errors: 
    [ { domain: 'global', 
    reason: 'INVALID_ARGUMENT', 
    message: 'can\'t have inequality filters on different properties: [start, end]' } ], 
    code: 400, 
    message: 'can\'t have inequality filters on different properties: [start, end]' } 

我可以編輯這個請求,或者用另一種方式來獲得按日期範圍的對象?

+0

可能的重複[可用日期範圍查詢在應用程序引擎數據存儲?](http://stackoverflow.com/questions/23319489/availability-date-range-queries-in-app-engine-datastore) –

+0

不,我使用nodejs和JSON API。 – MrPovod

+2

雲端數據存儲由相同的實施支持,並且僅支持單個媒體資源上的不平等過濾器: https://developers.google.com/datastore/docs/concepts/queries#Datastore_Inequality_filters_are_limited_to_at_most_one_property –

回答

0

在數據存儲/ gql不支持的單個查詢中有兩個不等式語句。

「開始> = 100和結束< = 150」

你可以有 「開始> = 100,並開始< = 150」

但不能同時開始和結束。

一個解決方案是您需要在您的GQL查詢中只設置一個不等式,並手動過濾第二個不等式的結果。