I want make geo Hastag mongodb But i don’t know format properly
this is format i read from site mongo:
db.places.ensureIndex( { loc : "2d"} , { bits : 26 } )
I want add some field index but the same index with geo hashtag.
Something like
http://www.mongodb.org/display/DOCS/Geospatial+Haystack+Indexing
However, I want the index to be compound indexes?
Should I do
db.tablebusiness.ensureIndex( {"LongitudeLatitude" : "2d",
"indexContents" : 1,
"Prominent" : -1 } ,
{ bits : 22 } )
If I do that, how does mongodb knows that bits:22 is an option for LongitudeLatitude part of the index?
Also what’s the equivalent for haystack indexing?
db.tablebusiness.ensureIndex( {"LongitudeLatitude" : "geoHaystack",
"indexContents" : 1,
"Prominent" : -1 } ,
{ bits : 22 ,bucketsize: .2} )
Is that correct?
It’s a syntactical thing. Your assumption above is correct. Since mongoDB supports only one geo-spatial index, and you specify that the LongitudeLatitude part of the index is geospatial with the “2d” index flag ( as opposed to 1 for ascending and -1 for descending), it knows that the bits parameters being passed to ensureIndex corresponds with the LongitudeLatitude field.
Same for Haystack indexing.