2017-03-17 5 views
-1

は、私は次のようなJSONの構造を有する:入れ子フィールドのGeoindex?

{ 
    "type": "Feature", 
    "id": "node/1717565071", 
    "properties": { 
    "type": "node", 
    "id": 1717565071, 
    "tags": { 
     "amenity": "post_box", 
     "operator": "P&T", 
     "collection_times": "Mo-Fr 08:30, Sa 08:00" 
    }, 
    "relations": [], 
    "meta": { 
     "timestamp": "2012-04-15T09:24:35Z", 
     "version": 1, 
     "changeset": 11307674, 
     "user": "kewl", 
     "uid": 317259 
    } 
    }, 
    "geometry": { 
    "type": "Point", 
    "coordinates": [ 
     6.1428674, 
     49.5716325 
    ] 
    } 
} 

は、私はそれのためgeoindexの作成を実行する必要があります。

私は、コマンドを実行します。

127.0.0.1:[email protected]> db.lux1.ensureIndex({ type: "geo", fields: [ "coordinates" ] }) 
{ 
    "id" : "lux1/569778", 
    "type" : "geo1", 
    "fields" : [ 
    "coordinates" 
    ], 
    "geoJson" : false, 
    "constraint" : false, 
    "unique" : false, 
    "ignoreNull" : true, 
    "sparse" : true, 
    "isNewlyCreated" : false, 
    "code" : 200 
} 

私はいくつかの処理ではなく、単純な出力を期待。

私も試してみました:

127.0.0.1:[email protected]> db.lux1.ensureIndex({ type: "geo", fields: [ "geometry.coordinates" ] }) 
{ 
    "id" : "lux1/570071", 
    "type" : "geo1", 
    "fields" : [ 
    "geometry.coordinates" 
    ], 
    "geoJson" : false, 
    "constraint" : false, 
    "unique" : false, 
    "ignoreNull" : true, 
    "sparse" : true, 
    "isNewlyCreated" : true, 
    "code" : 201 
} 

を私はfieldsを逃したと思います。

作成インデックスの右キーをどのように指定できますか?

答えて

0

パスが間違っているため、最初の試行は間違っています。 ArangoDBはすでにあなたに言った:"isNewlyCreated" : false

2回目の試行は正しいです、ArangoDBもあなたに言った:"isNewlyCreated" : true

なぜそれが機能しなかったと思いますか?ジオクエリを試してみてください。あなたのフィールドに地理インデックスがない場合は、エラーが発生します。

続きを読む:https://docs.arangodb.com/3.1/Manual/Indexing/Geo.html

関連する問題