Skip to content

Commit 840535a

Browse files
committed
Merge pull request #71 from hrushikesh/5f86eba0a04af29c4f33ded97b519bc78ca90265
RUBY-380 Support geoHaystack index type.
2 parents 8fd89eb + 5f86eba commit 840535a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/mongo.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
require 'mongo/version'
2222

2323
module Mongo
24-
ASCENDING = 1
25-
DESCENDING = -1
26-
GEO2D = '2d'
24+
ASCENDING = 1
25+
DESCENDING = -1
26+
GEO2D = '2d'
27+
GEOHAYSTACK = 'geoHaystack'
2728

2829
DEFAULT_MAX_BSON_SIZE = 4 * 1024 * 1024
2930

lib/mongo/collection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ def parse_index_spec(spec)
888888
field_spec[spec.to_s] = 1
889889
elsif spec.is_a?(Array) && spec.all? {|field| field.is_a?(Array) }
890890
spec.each do |f|
891-
if [Mongo::ASCENDING, Mongo::DESCENDING, Mongo::GEO2D].include?(f[1])
891+
if [Mongo::ASCENDING, Mongo::DESCENDING, Mongo::GEO2D, Mongo::GEOHAYSTACK].include?(f[1])
892892
field_spec[f[0].to_s] = f[1]
893893
else
894894
raise MongoArgumentError, "Invalid index field #{f[1].inspect}; " +

0 commit comments

Comments
 (0)