|
The docs recommend a functionality I'm having trouble implementing.
Reference page: http://docs.mongodb.org/manual/tutorial/build-a-2d-index/
Also relevant: http://docs.mongodb.org/manual/core/2d/, http://docs.mongodb.org/manual/core/geospatial-indexes/
I see that the format is
db.<collection>.ensureIndex( { <location field> : "2d" ,
|
<additional field> : <value> } ,
|
{ <index-specification options> } )
|
and index options are
{ min : <lower bound> , max : <upper bound> ,
|
bits : <bit precision> }
|
Steps to try to reproduce this:
> db.2dindex.ensureIndex( { coords : "2d", name : 1 }, { min : -180, max : 180, bits : 10 } )
|
2014-09-03T10:37:24.819-0400 SyntaxError: Unexpected token ILLEGAL
|
> db.2dindex.ensureIndex( { coords : "2d"}, { min : [ -180, -90 ], max : [ 180, 90 ], bits : 10 } )
|
2014-09-03T10:39:23.576-0400 SyntaxError: Unexpected token ILLEGAL
|
> db.2dindex.ensureIndex( { coords : "2d"}, { } )
|
2014-09-03T10:47:36.811-0400 SyntaxError: Unexpected token ILLEGAL
|
> db.2dindex.ensureIndex( { coords : "2d"}, { min : { lng : -180, lat : -90 }, max : { lng : 180, lat : 90 } } )
|
2014-09-03T10:50:09.806-0400 SyntaxError: Unexpected token ILLEGAL
|
|