MongoDB: Geospatial Index array not in correct format
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: While trying to setup to use the Geospatial Index on MongoDB, I run into the error message that the location array is not in the correct format. This is my collection "test". { "_id" : ObjectId ( "4f037ac176d6fdab5b00000a" ), "CorporateId" : "XYZ12345" , "Places" : [ { "Location" : { "Longitude" : "50.0" , "Latitude" : "50.0" }, "ValidFrom" : "2011-11-01 00:00:00" , "ValidTo" : "2021-12-31 00:00:00" , "itemCount" : "1" } ] } Once I run this code. db . test . ensureIndex ({ "Places.Location" : "2d" }); I get this error message