add geoHaystack index support

This commit is contained in:
Hrushikesh 2011-12-03 13:41:53 -08:00
parent 221c40da3f
commit 5f86eba0a0
2 changed files with 5 additions and 4 deletions

View File

@ -24,6 +24,7 @@ module Mongo
ASCENDING = 1
DESCENDING = -1
GEO2D = '2d'
GEOHAYSTACK = 'geoHaystack'
DEFAULT_MAX_BSON_SIZE = 4 * 1024 * 1024

View File

@ -888,7 +888,7 @@ module Mongo
field_spec[spec.to_s] = 1
elsif spec.is_a?(Array) && spec.all? {|field| field.is_a?(Array) }
spec.each do |f|
if [Mongo::ASCENDING, Mongo::DESCENDING, Mongo::GEO2D].include?(f[1])
if [Mongo::ASCENDING, Mongo::DESCENDING, Mongo::GEO2D, Mongo::GEOHAYSTACK].include?(f[1])
field_spec[f[0].to_s] = f[1]
else
raise MongoArgumentError, "Invalid index field #{f[1].inspect}; " +