2012-06-30 24 views

回答

1

我假設你的意思是玩1.2.x.

不能從@Indexed註解做到這一點的是,它似乎是:http://code.google.com/p/morphia/issues/detail?id=290

你可以用這個有點哈克[未經測試]代碼做到這一點:

MorphiaPlugin.ds() 
    .getMongo() 
    .getDB('dbname') 
    .getCollection('places') 
    .ensureIndex(BasicDBObject(loc, "2d")); 

但你可能只是想就像你展示的那樣從shell中完成它。這是一次性的事情。

+0

正確,它的遊戲1.2.x. Bummer缺乏2D支持。 – darren