mongodb - Problems with operating Json type
给我你的怀抱
给我你的怀抱 2017-05-31 10:35:19
0
2
677

There is a Document in mongodb:

{
   "_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"
}

I put it into Greenplum for analysis and stored it in Json type.

create table restaurant(restau json);

Some simple queries can be used;

select restau from restaurant where restau-> restaurant_id='41704620';

but,

select restau from restaurant where restau-> address -> zipcode ='10075';

Why doesn’t this work? Report syntax error.

给我你的怀抱
给我你的怀抱

reply all(2)
大家讲道理

Suggest giving grammatical errors,

刘奇

Which version of GP are you using?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template