我正在尝试通过新的AWS DocumentDB服务运行现有应用程序。我试图从mongo shell运行db.geojson.createIndex( { geoData : "2dsphere" , sessionId:1 } )
并收到{ "ok" : 0, "errmsg" : "Index type not supported : 2dsphere", "code" : 303 }
此代码与实际的MongoDb实例兼容,但不适用于新的AWS服务,该服务应该与MongoDB 3.6兼容
没有AWS DocumentDB不支持地理空间索引或查询。这里有几个索引限制:https://docs.aws.amazon.com/documentdb/latest/developerguide/mongo-apis-index.html
为了使用2dsphere索引,您可以在AWS上使用MongoDB Atlas并有权访问MongoDB API和功能的全部集合。
这些是发布时的indexes supported by DocumentDB:
Single Field Index - Yes
Compound Index - Yes
Multikey Index - Yes
Text Index - No
2dsphere - No
2d Index - No
Hashed Index - No