创建要加载到mongodb的embebbed文档

时间:2015-10-08 23:17:13

标签: json mongodb

我有3个JSON - 航班飞机机场。当飞机中航班中的钥匙相同时,我想将飞机机场嵌入航班 机场。如何创建嵌入式JSON以加载到MongoDB?

JSON飞机:

{  
  "tailnum":"N14334",
  "issue_data":"09/02/1997",
  "status":"Valid",
  "year":"1986\r",
  "type":"Corporation",
  "engine_type":"Turbo-Jet",
  "model":"737-3TO",
  "aircraft_type":"Fixed Wing Multi-Engine",
  "airline":"Continental Air Lines Inc.",
  "manufacturer":"BOEING"
}

JSON机场:

{  
  "idairport":"00M",
  "airport":"Thigpen ",
  "city":"Bay Springs",
  "state":"MS",
  "country":"USA",
  "latitude":"31,95376472",
  "longitude":"-89,23450472"
}

JSON航班:

{  
  "id_flight":1,
  "year":1995,
  "month":1,
  "dayofmonth":2,
  "dayofweek":1,
  "deptime":1148,
  "crsdeptime":1145,
  "arrtime":1428,
  "crsarrtime":1435,
  "flightnum":"1845",
  "tailnum":"N14334",
  "actualelapsedtime":100,
  "crselapsedtime":110,
  "airtime":80,
  "arrdelay":-7,
  "depdelay":3,
  "origin":"00M",
  "dest":"PHL",
  "distance":678,
  "taxiin":5,
  "taxiout":15,
  "cancelled":"0",
  "diverted":"0"
}

所以在JSON flight 这里是origin,我想添加文档 airport ,什么时候是tailnum,我想添加文档飞机就像一种嵌入式方式。

0 个答案:

没有答案