2013-12-17 69 views
0

我有一個蒙戈集合,其中每個文件都有一個「祿」點陣如下:的MongoDB:地理空間索引沒有得到補充

> db.trucks.findOne() 
{ 
    "_id" : ObjectId("52afe2a9e8de3f311ec675ee"), 
    "objectid" : "427856", 
    "fooditems" : "Cupcakes", 
    "facilitytype" : "Truck", 
    "loc" : [ 
     37.7901490737255, 
     -122.398658184604 
    ], 
    "priorpermit" : "0", 
    "location" : { 
     "latitude" : "37.7901490874965", 
     "needs_recoding" : false, 
     "longitude" : "-122.398658184594" 
    }, 
    "lot" : "055", 
    "cnn" : "101000", 
    "status" : "REQUESTED", 
    "schedule" : "http://bsm.sfdpw.org/PermitsTracker/reports/report.aspx?title=schedule&report=rptSchedule&params=permit=13MFF-0068&ExportPDF=1&Filename=13MFF-0068_schedule.pdf", 
    "locationdescription" : "01ST ST: STEVENSON ST to JESSIE ST (21 - 56)", 
    "latitude" : "37.7901490737255", 
    "blocklot" : "3708055", 
    "address" : "50 01ST ST", 
    "received" : "Mar 14 2013 3:34PM", 
    "applicant" : "Cupkates Bakery, LLC", 
    "longitude" : "-122.398658184604", 
    "expirationdate" : "2013-03-15T00:00:00", 
    "permit" : "13MFF-0068", 
    "y" : "2115738.283", 
    "x" : "6013063.33", 
    "block" : "3708" 
} 

當我試圖指數「祿」,它並不會增加:

> db.trucks.ensureIndex({ loc : "2d" }) 
> db.trucks.getIndexes() 
[ 
    { 
     "v" : 1, 
     "key" : { 
      "_id" : 1 
     }, 
     "ns" : "food.trucks", 
     "name" : "_id_" 
    } 
] 

我在做什麼錯?

回答

0

不應該是db.trucks.ensureIndex({loc:「2d」})?
您正在創建某些其他集合的索引。

+0

哎呀,錯字。仍然有相同的問題 – tldr

+0

我放棄並重新啓動我的電腦,現在它的作品:$ – tldr

+0

這很奇怪! ! – dex

相關問題