mongo-parser-rb 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -85,12 +85,12 @@ module MongoParserRB
85
85
  def evaluate_negative_equality(document)
86
86
  value_for_field = @field.value_in_document(document)
87
87
 
88
- # Mongo negative equality operators return true when
89
- # the specified field does not exist on a document.
90
- return true if !value_for_field && !@field.in_document?(document)
91
-
92
88
  case @operator
93
89
  when :$ne
90
+ # Mongo negative equality operators return true when
91
+ # the specified field does not exist on a document.
92
+ return true if !value_for_field && !@field.in_document?(document)
93
+
94
94
  value_for_field != @arguments
95
95
  when :$nin
96
96
  if value_for_field.kind_of?(Array)
@@ -129,4 +129,4 @@ module MongoParserRB
129
129
  end
130
130
  end
131
131
  end
132
- end
132
+ end
@@ -1,3 +1,3 @@
1
1
  module MongoParserRB
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -122,6 +122,12 @@ class QueryTest < MiniTest::Unit::TestCase
122
122
  refute query.matches_document?(:array_key => [1,4,5])
123
123
  end
124
124
 
125
+ def test_nil_by_absence_nin
126
+ query = MongoParserRB::Query.parse(:"custom_data.value" => {:$nin => [nil]})
127
+ assert query.matches_document?(:custom_data => {:value => 5})
128
+ refute query.matches_document?({})
129
+ end
130
+
125
131
  def test_integer_in
126
132
  query = MongoParserRB::Query.parse(:integer_key => {:$in => [1,2]})
127
133
  assert query.matches_document?(:integer_key => 1)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo-parser-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-04 00:00:00.000000000 Z
12
+ date: 2013-06-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Parse and evaluate mongo queries in Ruby
15
15
  email: