Merge pull request #71 from hrushikesh/5f86eba0a04af29c4f33ded97b519bc78ca90265
RUBY-380 Support geoHaystack index type.
This commit is contained in:
commit
840535aa61
|
@ -21,9 +21,10 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
||||||
require 'mongo/version'
|
require 'mongo/version'
|
||||||
|
|
||||||
module Mongo
|
module Mongo
|
||||||
ASCENDING = 1
|
ASCENDING = 1
|
||||||
DESCENDING = -1
|
DESCENDING = -1
|
||||||
GEO2D = '2d'
|
GEO2D = '2d'
|
||||||
|
GEOHAYSTACK = 'geoHaystack'
|
||||||
|
|
||||||
DEFAULT_MAX_BSON_SIZE = 4 * 1024 * 1024
|
DEFAULT_MAX_BSON_SIZE = 4 * 1024 * 1024
|
||||||
|
|
||||||
|
|
|
@ -888,7 +888,7 @@ module Mongo
|
||||||
field_spec[spec.to_s] = 1
|
field_spec[spec.to_s] = 1
|
||||||
elsif spec.is_a?(Array) && spec.all? {|field| field.is_a?(Array) }
|
elsif spec.is_a?(Array) && spec.all? {|field| field.is_a?(Array) }
|
||||||
spec.each do |f|
|
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]
|
field_spec[f[0].to_s] = f[1]
|
||||||
else
|
else
|
||||||
raise MongoArgumentError, "Invalid index field #{f[1].inspect}; " +
|
raise MongoArgumentError, "Invalid index field #{f[1].inspect}; " +
|
||||||
|
|
Loading…
Reference in New Issue