why do i get the error 13027: 开发者_StackOverflowpoint not in range
when i run db:create_indexes
?
the index declaration in the model is index [[ :location, Mongo::GEO2D ]], :min => 200, :max => 200
This basically means one of the points in your collection is outside of the min/max that you specified. For example:
repl0:PRIMARY> db.points.insert({loc: {lat: 125, lon: 236}})
repl0:PRIMARY> db.points.ensureIndex({loc: '2d'}, {min: 126, max: 237})
point not in range
repl0:PRIMARY> db.points.ensureIndex({loc: '2d'}, {min: 125, max: 237})
in > 0
repl0:PRIMARY> db.points.ensureIndex({loc: '2d'}, {min: 124, max: 237})
In your example you also have min and max set to the same value.
精彩评论