mongodb中有一個Documents:
{
"_id" : ObjectId("54c955492b7c8eb21818bd09"),
"address" : {
"street" : "2 Avenue",
"zipcode" : "10075",
"building" : "1480",
"coord" : [ -73.9557413, 40.7720266 ]
},
"borough" : "Manhattan",
"cuisine" : "Italian",
"grades" : [
{
"date" : ISODate("2014-10-01T00:00:00Z"),
"grade" : "A",
"score" : 11
},
{
"date" : ISODate("2014-01-16T00:00:00Z"),
"grade" : "B",
"score" : 17
}
],
"name" : "Vella",
"restaurant_id" : "41704620"
}
我把它放到Greenplum中分析,用Json類型儲存。
create table restaurant(restau json);
一些簡單的查詢可以用;
select restau from restaurant where restau-> restaurant_id='41704620';
但是,
select restau from restaurant where restau-> address -> zipcode ='10075';
這樣為什麼不行?報語法錯誤。