2017-03-17 3 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.

ArangoDB에서 설명한 두 번째 시도가 정확합니다. "isNewlyCreated" : true.

왜 작동하지 않는 걸까요? 지리적 쿼리를 사용해보십시오. 필드에 지리적 색인이 없으면 오류가 발생합니다.

자세히 알아보기 : https://docs.arangodb.com/3.1/Manual/Indexing/Geo.html

관련 문제