mongoid 7.2.0 → 7.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Rakefile +16 -0
- data/lib/config/locales/en.yml +2 -2
- data/lib/mongoid/association/accessors.rb +1 -1
- data/lib/mongoid/association/constrainable.rb +1 -1
- data/lib/mongoid/association/depending.rb +4 -4
- data/lib/mongoid/association/embedded/batchable.rb +1 -1
- data/lib/mongoid/association/embedded/embedded_in.rb +1 -1
- data/lib/mongoid/association/embedded/embeds_many/proxy.rb +10 -3
- data/lib/mongoid/association/nested/many.rb +1 -1
- data/lib/mongoid/association/nested/one.rb +4 -2
- data/lib/mongoid/association/proxy.rb +6 -1
- data/lib/mongoid/association/referenced/auto_save.rb +2 -2
- data/lib/mongoid/association/referenced/has_many/enumerable.rb +493 -495
- data/lib/mongoid/association/referenced/has_many/proxy.rb +2 -2
- data/lib/mongoid/association/referenced/has_one/nested_builder.rb +2 -2
- data/lib/mongoid/attributes/projector.rb +120 -0
- data/lib/mongoid/attributes.rb +32 -14
- data/lib/mongoid/cacheable.rb +2 -2
- data/lib/mongoid/clients/factory.rb +22 -8
- data/lib/mongoid/clients.rb +1 -1
- data/lib/mongoid/config.rb +19 -2
- data/lib/mongoid/contextual/aggregable/mongo.rb +10 -8
- data/lib/mongoid/copyable.rb +1 -1
- data/lib/mongoid/criteria/findable.rb +1 -1
- data/lib/mongoid/criteria/queryable/expandable.rb +0 -24
- data/lib/mongoid/criteria/queryable/extensions/boolean.rb +1 -1
- data/lib/mongoid/criteria/queryable/extensions.rb +0 -4
- data/lib/mongoid/criteria/queryable/mergeable.rb +46 -20
- data/lib/mongoid/criteria/queryable/selectable.rb +8 -8
- data/lib/mongoid/criteria/queryable/selector.rb +0 -4
- data/lib/mongoid/criteria.rb +4 -5
- data/lib/mongoid/document.rb +4 -17
- data/lib/mongoid/errors/delete_restriction.rb +8 -9
- data/lib/mongoid/evolvable.rb +1 -1
- data/lib/mongoid/extensions/boolean.rb +1 -2
- data/lib/mongoid/extensions/false_class.rb +1 -1
- data/lib/mongoid/extensions/hash.rb +2 -2
- data/lib/mongoid/extensions/true_class.rb +1 -1
- data/lib/mongoid/fields.rb +43 -5
- data/lib/mongoid/inspectable.rb +1 -1
- data/lib/mongoid/interceptable.rb +3 -1
- data/lib/mongoid/matcher/bits.rb +41 -0
- data/lib/mongoid/matcher/bits_all_clear.rb +20 -0
- data/lib/mongoid/matcher/bits_all_set.rb +20 -0
- data/lib/mongoid/matcher/bits_any_clear.rb +20 -0
- data/lib/mongoid/matcher/bits_any_set.rb +20 -0
- data/lib/mongoid/matcher/elem_match.rb +2 -1
- data/lib/mongoid/matcher/expression.rb +9 -14
- data/lib/mongoid/matcher/field_expression.rb +4 -5
- data/lib/mongoid/matcher/field_operator.rb +13 -11
- data/lib/mongoid/matcher/mod.rb +17 -0
- data/lib/mongoid/matcher/type.rb +99 -0
- data/lib/mongoid/matcher.rb +26 -43
- data/lib/mongoid/persistable/deletable.rb +1 -2
- data/lib/mongoid/persistable/destroyable.rb +8 -2
- data/lib/mongoid/persistable/updatable.rb +27 -2
- data/lib/mongoid/query_cache.rb +35 -29
- data/lib/mongoid/reloadable.rb +5 -0
- data/lib/mongoid/selectable.rb +5 -7
- data/lib/mongoid/shardable.rb +21 -5
- data/lib/mongoid/touchable.rb +23 -4
- data/lib/mongoid/version.rb +1 -1
- data/lib/rails/generators/mongoid/config/config_generator.rb +8 -1
- data/spec/integration/app_spec.rb +171 -84
- data/spec/integration/associations/embeds_many_spec.rb +44 -0
- data/spec/integration/associations/has_one_spec.rb +48 -0
- data/spec/integration/callbacks_models.rb +49 -0
- data/spec/integration/callbacks_spec.rb +216 -0
- data/spec/integration/criteria/date_field_spec.rb +1 -1
- data/spec/integration/document_spec.rb +30 -0
- data/spec/integration/matcher_operator_data/bits_all_clear.yml +159 -0
- data/spec/integration/matcher_operator_data/bits_all_set.yml +159 -0
- data/spec/integration/matcher_operator_data/bits_any_clear.yml +159 -0
- data/spec/integration/matcher_operator_data/bits_any_set.yml +159 -0
- data/spec/integration/matcher_operator_data/comment.yml +22 -0
- data/spec/integration/matcher_operator_data/elem_match.yml +46 -0
- data/spec/integration/matcher_operator_data/gt_types.yml +63 -0
- data/spec/integration/matcher_operator_data/gte_types.yml +15 -0
- data/spec/integration/matcher_operator_data/implicit_traversal.yml +96 -0
- data/spec/integration/matcher_operator_data/in.yml +16 -0
- data/spec/integration/matcher_operator_data/lt_types.yml +15 -0
- data/spec/integration/matcher_operator_data/lte_types.yml +15 -0
- data/spec/integration/matcher_operator_data/mod.yml +55 -0
- data/spec/integration/matcher_operator_data/ne_types.yml +15 -0
- data/spec/integration/matcher_operator_data/type.yml +70 -0
- data/spec/integration/matcher_operator_data/type_array.yml +16 -0
- data/spec/integration/matcher_operator_data/type_binary.yml +18 -0
- data/spec/integration/matcher_operator_data/type_boolean.yml +39 -0
- data/spec/integration/matcher_operator_data/type_code.yml +26 -0
- data/spec/integration/matcher_operator_data/type_code_with_scope.yml +26 -0
- data/spec/integration/matcher_operator_data/type_date.yml +39 -0
- data/spec/integration/matcher_operator_data/type_db_pointer.yml +19 -0
- data/spec/integration/matcher_operator_data/type_decimal.yml +40 -0
- data/spec/integration/matcher_operator_data/type_double.yml +15 -0
- data/spec/integration/matcher_operator_data/type_int32.yml +33 -0
- data/spec/integration/matcher_operator_data/type_int64.yml +33 -0
- data/spec/integration/matcher_operator_data/type_max_key.yml +17 -0
- data/spec/integration/matcher_operator_data/type_min_key.yml +17 -0
- data/spec/integration/matcher_operator_data/type_null.yml +23 -0
- data/spec/integration/matcher_operator_data/type_object.yml +23 -0
- data/spec/integration/matcher_operator_data/type_object_id.yml +25 -0
- data/spec/integration/matcher_operator_data/type_regex.yml +44 -0
- data/spec/integration/matcher_operator_data/type_string.yml +15 -0
- data/spec/integration/matcher_operator_data/type_symbol.yml +32 -0
- data/spec/integration/matcher_operator_data/type_timestamp.yml +25 -0
- data/spec/integration/matcher_operator_data/type_undefined.yml +17 -0
- data/spec/lite_spec_helper.rb +5 -4
- data/spec/mongoid/association/depending_spec.rb +391 -352
- data/spec/mongoid/association/embedded/embedded_in/proxy_spec.rb +50 -0
- data/spec/mongoid/association/nested/one_spec.rb +18 -14
- data/spec/mongoid/association/referenced/belongs_to/proxy_spec.rb +25 -8
- data/spec/mongoid/association/referenced/has_and_belongs_to_many/binding_spec.rb +1 -1
- data/spec/mongoid/association/referenced/has_many/binding_spec.rb +1 -1
- data/spec/mongoid/association/referenced/has_many/enumerable_spec.rb +1 -1
- data/spec/mongoid/association/referenced/has_one_models.rb +8 -0
- data/spec/mongoid/atomic/paths_spec.rb +105 -12
- data/spec/mongoid/attributes/projector_data/embedded.yml +105 -0
- data/spec/mongoid/attributes/projector_data/fields.yml +93 -0
- data/spec/mongoid/attributes/projector_spec.rb +41 -0
- data/spec/mongoid/attributes_spec.rb +333 -0
- data/spec/mongoid/clients/factory_spec.rb +48 -0
- data/spec/mongoid/config_spec.rb +32 -0
- data/spec/mongoid/contextual/atomic_spec.rb +17 -4
- data/spec/mongoid/contextual/mongo_spec.rb +2 -2
- data/spec/mongoid/criteria/modifiable_spec.rb +1 -1
- data/spec/mongoid/criteria/queryable/expandable_spec.rb +0 -73
- data/spec/mongoid/criteria/queryable/extensions/boolean_spec.rb +1 -1
- data/spec/mongoid/criteria/queryable/mergeable_spec.rb +105 -7
- data/spec/mongoid/criteria/queryable/selectable_logical_spec.rb +265 -24
- data/spec/mongoid/criteria/queryable/selectable_shared_examples.rb +39 -0
- data/spec/mongoid/criteria/queryable/selectable_spec.rb +1 -565
- data/spec/mongoid/criteria/queryable/selectable_where_spec.rb +590 -0
- data/spec/mongoid/criteria_projection_spec.rb +411 -0
- data/spec/mongoid/criteria_spec.rb +0 -275
- data/spec/mongoid/document_fields_spec.rb +26 -0
- data/spec/mongoid/document_spec.rb +13 -13
- data/spec/mongoid/errors/delete_restriction_spec.rb +1 -1
- data/spec/mongoid/extensions/false_class_spec.rb +1 -1
- data/spec/mongoid/extensions/string_spec.rb +5 -5
- data/spec/mongoid/extensions/true_class_spec.rb +1 -1
- data/spec/mongoid/fields/localized_spec.rb +4 -4
- data/spec/mongoid/fields_spec.rb +4 -4
- data/spec/mongoid/inspectable_spec.rb +12 -4
- data/spec/mongoid/matcher/extract_attribute_data/numeric_keys.yml +104 -0
- data/spec/mongoid/matcher/extract_attribute_data/traversal.yml +68 -88
- data/spec/mongoid/matcher/extract_attribute_spec.rb +3 -13
- data/spec/mongoid/persistable/deletable_spec.rb +175 -1
- data/spec/mongoid/persistable/destroyable_spec.rb +191 -3
- data/spec/mongoid/persistable/savable_spec.rb +3 -5
- data/spec/mongoid/persistable/settable_spec.rb +30 -0
- data/spec/mongoid/persistable/upsertable_spec.rb +1 -1
- data/spec/mongoid/query_cache_middleware_spec.rb +8 -0
- data/spec/mongoid/reloadable_spec.rb +18 -1
- data/spec/mongoid/shardable_spec.rb +44 -0
- data/spec/mongoid/touchable_spec.rb +104 -16
- data/spec/mongoid/touchable_spec_models.rb +52 -0
- data/spec/mongoid/validatable_spec.rb +1 -1
- data/spec/shared/bin/get-mongodb-download-url +17 -0
- data/spec/shared/lib/mrss/cluster_config.rb +221 -0
- data/spec/shared/lib/mrss/constraints.rb +51 -0
- data/spec/shared/lib/mrss/docker_runner.rb +265 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +16 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +115 -0
- data/spec/shared/lib/mrss/spec_organizer.rb +14 -1
- data/spec/shared/lib/mrss/utils.rb +15 -0
- data/spec/shared/share/Dockerfile.erb +231 -0
- data/spec/shared/shlib/distro.sh +73 -0
- data/spec/shared/shlib/server.sh +290 -0
- data/spec/shared/shlib/set_env.sh +128 -0
- data/spec/spec_helper.rb +6 -2
- data/spec/support/client_registry.rb +9 -0
- data/spec/support/models/bolt.rb +8 -0
- data/spec/support/models/customer.rb +11 -0
- data/spec/support/models/customer_address.rb +12 -0
- data/spec/support/models/dictionary.rb +6 -0
- data/spec/support/models/hole.rb +13 -0
- data/spec/support/models/mop.rb +9 -0
- data/spec/support/models/nut.rb +8 -0
- data/spec/support/models/person.rb +6 -0
- data/spec/support/models/sealer.rb +8 -0
- data/spec/support/models/shirt.rb +12 -0
- data/spec/support/models/spacer.rb +8 -0
- data/spec/support/models/threadlocker.rb +8 -0
- data/spec/support/models/washer.rb +8 -0
- data/spec/support/spec_config.rb +8 -0
- data.tar.gz.sig +0 -0
- metadata +146 -14
- metadata.gz.sig +5 -2
- data/spec/support/cluster_config.rb +0 -158
@@ -0,0 +1,216 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'spec_helper'
|
5
|
+
require_relative './callbacks_models'
|
6
|
+
|
7
|
+
describe 'callbacks integration tests' do
|
8
|
+
context 'when modifying attributes in a callback' do
|
9
|
+
|
10
|
+
context 'when creating top-level document' do
|
11
|
+
context 'top level document' do
|
12
|
+
let(:instance) do
|
13
|
+
Galaxy.create!
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'writes the attribute value into the model' do
|
17
|
+
instance.age.should == 100_000
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'persists the attribute value' do
|
21
|
+
Galaxy.find(instance.id).age.should == 100_000
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'embedded document' do
|
26
|
+
shared_examples 'persists the attribute value' do
|
27
|
+
it 'writes the attribute value into the model' do
|
28
|
+
instance.stars.first.age.should == 42_000
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'persists the attribute value' do
|
32
|
+
Galaxy.find(instance.id).stars.first.age.should == 42_000
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'set as a document instance' do
|
37
|
+
let(:instance) do
|
38
|
+
Galaxy.create!(stars: [Star.new])
|
39
|
+
end
|
40
|
+
|
41
|
+
include_examples 'persists the attribute value'
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'set as attributes on parent' do
|
45
|
+
let(:instance) do
|
46
|
+
Galaxy.create!(stars: [{}])
|
47
|
+
end
|
48
|
+
|
49
|
+
include_examples 'persists the attribute value'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'nested embedded document' do
|
54
|
+
shared_examples 'persists the attribute value' do
|
55
|
+
it 'writes the attribute value into the model' do
|
56
|
+
instance.stars.first.planets.first.age.should == 2_000
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'persists the attribute value' do
|
60
|
+
Galaxy.find(instance.id).stars.first.planets.first.age.should == 2_000
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'set as a document instance' do
|
65
|
+
let(:instance) do
|
66
|
+
Galaxy.create!(stars: [Star.new(
|
67
|
+
planets: [Planet.new],
|
68
|
+
)])
|
69
|
+
end
|
70
|
+
|
71
|
+
include_examples 'persists the attribute value'
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'set as attributes on parent' do
|
75
|
+
let(:instance) do
|
76
|
+
Galaxy.create!(stars: [
|
77
|
+
planets: [{}],
|
78
|
+
])
|
79
|
+
end
|
80
|
+
|
81
|
+
include_examples 'persists the attribute value'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'when updating top-level document via #save' do
|
87
|
+
let!(:instance) do
|
88
|
+
Galaxy.create!
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'embedded document' do
|
92
|
+
shared_examples 'persists the attribute value' do
|
93
|
+
it 'writes the attribute value into the model' do
|
94
|
+
instance.stars.first.age.should == 42_000
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'persists the attribute value' do
|
98
|
+
Galaxy.find(instance.id).stars.first.age.should == 42_000
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context 'set as a document instance' do
|
103
|
+
before do
|
104
|
+
instance.stars = [Star.new]
|
105
|
+
instance.save!
|
106
|
+
end
|
107
|
+
|
108
|
+
include_examples 'persists the attribute value'
|
109
|
+
end
|
110
|
+
|
111
|
+
context 'set as attributes on parent' do
|
112
|
+
before do
|
113
|
+
instance.stars = [{}]
|
114
|
+
instance.save!
|
115
|
+
end
|
116
|
+
|
117
|
+
include_examples 'persists the attribute value'
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'nested embedded document' do
|
122
|
+
shared_examples 'persists the attribute value' do
|
123
|
+
it 'writes the attribute value into the model' do
|
124
|
+
instance.stars.first.planets.first.age.should == 2_000
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'persists the attribute value' do
|
128
|
+
Galaxy.find(instance.id).stars.first.planets.first.age.should == 2_000
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'set as a document instance' do
|
133
|
+
before do
|
134
|
+
instance.stars = [Star.new(planets: [Planet.new])]
|
135
|
+
instance.save!
|
136
|
+
end
|
137
|
+
|
138
|
+
include_examples 'persists the attribute value'
|
139
|
+
end
|
140
|
+
|
141
|
+
context 'set as attributes on parent' do
|
142
|
+
before do
|
143
|
+
instance.stars = [planets: [{}]]
|
144
|
+
instance.save!
|
145
|
+
end
|
146
|
+
|
147
|
+
include_examples 'persists the attribute value'
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
context 'when updating top-level document via #update_attributes' do
|
153
|
+
let!(:instance) do
|
154
|
+
Galaxy.create!
|
155
|
+
end
|
156
|
+
|
157
|
+
context 'embedded document' do
|
158
|
+
shared_examples 'persists the attribute value' do
|
159
|
+
it 'writes the attribute value into the model' do
|
160
|
+
instance.stars.first.age.should == 42_000
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'persists the attribute value' do
|
164
|
+
Galaxy.find(instance.id).stars.first.age.should == 42_000
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context 'set as a document instance' do
|
169
|
+
before do
|
170
|
+
instance.update_attributes(stars: [Star.new])
|
171
|
+
end
|
172
|
+
|
173
|
+
include_examples 'persists the attribute value'
|
174
|
+
end
|
175
|
+
|
176
|
+
context 'set as attributes on parent' do
|
177
|
+
before do
|
178
|
+
instance.update_attributes(stars: [{}])
|
179
|
+
end
|
180
|
+
|
181
|
+
include_examples 'persists the attribute value'
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
context 'nested embedded document' do
|
186
|
+
shared_examples 'persists the attribute value' do
|
187
|
+
it 'writes the attribute value into the model' do
|
188
|
+
instance.stars.first.planets.first.age.should == 2_000
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'persists the attribute value' do
|
192
|
+
pending 'MONGOID-4476'
|
193
|
+
|
194
|
+
Galaxy.find(instance.id).stars.first.planets.first.age.should == 2_000
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
context 'set as a document instance' do
|
199
|
+
before do
|
200
|
+
instance.update_attributes(stars: [Star.new(planets: [Planet.new])])
|
201
|
+
end
|
202
|
+
|
203
|
+
include_examples 'persists the attribute value'
|
204
|
+
end
|
205
|
+
|
206
|
+
context 'set as attributes on parent' do
|
207
|
+
before do
|
208
|
+
instance.update_attributes(stars: [planets: [{}]])
|
209
|
+
end
|
210
|
+
|
211
|
+
include_examples 'persists the attribute value'
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
@@ -12,7 +12,7 @@ describe 'Queries on Date fields' do
|
|
12
12
|
|
13
13
|
shared_examples 'converts to beginning of day in UTC' do
|
14
14
|
it 'converts to beginning of day in UTC' do
|
15
|
-
selector['founded'].should == arg.
|
15
|
+
selector['founded'].should == Time.utc(arg.year, arg.month, arg.day)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -19,4 +19,34 @@ describe Mongoid::Document do
|
|
19
19
|
DelegatingPatient.default_client.should be Mongoid.default_client
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
context 'when id is unaliased' do
|
24
|
+
it 'persists separate id and _id values' do
|
25
|
+
shirt = Shirt.create!(id: 'hello', _id: 'foo')
|
26
|
+
shirt = Shirt.find(shirt._id)
|
27
|
+
shirt.id.should == 'hello'
|
28
|
+
shirt._id.should == 'foo'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#reload' do
|
33
|
+
context 'when changing shard key value' do
|
34
|
+
require_topology :sharded
|
35
|
+
|
36
|
+
let(:profile) do
|
37
|
+
# Profile shard_key :name
|
38
|
+
Profile.create!(name: "Alice")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "successfully reloads the document after saving an update to the sharded field" do
|
42
|
+
expect(profile.name).to eq("Alice")
|
43
|
+
profile.name = "Bob"
|
44
|
+
profile.save!
|
45
|
+
|
46
|
+
profile.reload
|
47
|
+
|
48
|
+
expect(profile.name).to eq("Bob")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
22
52
|
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
- name: existing field - matches with int
|
2
|
+
document:
|
3
|
+
a: 20
|
4
|
+
binaryValueofA: "00010100"
|
5
|
+
query:
|
6
|
+
a:
|
7
|
+
$bitsAllClear: 35
|
8
|
+
matches: true
|
9
|
+
min_server_version: 3.2
|
10
|
+
|
11
|
+
- name: existing field - does not match with int
|
12
|
+
document:
|
13
|
+
a: 20
|
14
|
+
binaryValueofA: "00010100"
|
15
|
+
query:
|
16
|
+
a:
|
17
|
+
$bitsAllClear: 24
|
18
|
+
matches: false
|
19
|
+
min_server_version: 3.2
|
20
|
+
|
21
|
+
- name: existing field - matches with binData
|
22
|
+
document:
|
23
|
+
a: 20
|
24
|
+
binaryValueofA: "00010100"
|
25
|
+
query:
|
26
|
+
a:
|
27
|
+
$bitsAllClear: !ruby/object:BSON::Binary
|
28
|
+
data: !binary |-
|
29
|
+
IW==
|
30
|
+
type: :generic
|
31
|
+
matches: true
|
32
|
+
min_server_version: 3.2
|
33
|
+
|
34
|
+
- name: existing field - does not match with binData
|
35
|
+
document:
|
36
|
+
a: 21
|
37
|
+
binaryValueofA: "00010101"
|
38
|
+
query:
|
39
|
+
a:
|
40
|
+
$bitsAllClear: !ruby/object:BSON::Binary
|
41
|
+
data: !binary |-
|
42
|
+
IW==
|
43
|
+
type: :generic
|
44
|
+
matches: false
|
45
|
+
min_server_version: 3.2
|
46
|
+
|
47
|
+
- name: existing binData field matches
|
48
|
+
document:
|
49
|
+
a: !ruby/object:BSON::Binary
|
50
|
+
data: !binary |-
|
51
|
+
IW==
|
52
|
+
type: :generic
|
53
|
+
query:
|
54
|
+
a:
|
55
|
+
$bitsAllClear: 20
|
56
|
+
matches: true
|
57
|
+
min_server_version: 3.2
|
58
|
+
|
59
|
+
- name: existing binData field does not match
|
60
|
+
document:
|
61
|
+
a: !ruby/object:BSON::Binary
|
62
|
+
data: !binary |-
|
63
|
+
IW==
|
64
|
+
type: :generic
|
65
|
+
query:
|
66
|
+
a:
|
67
|
+
$bitsAllClear: 15
|
68
|
+
matches: false
|
69
|
+
min_server_version: 3.2
|
70
|
+
|
71
|
+
- name: existing field - matches with array
|
72
|
+
document:
|
73
|
+
a: 20
|
74
|
+
binaryValueofA: "00010100"
|
75
|
+
query:
|
76
|
+
a:
|
77
|
+
$bitsAllClear: [0, 3]
|
78
|
+
matches: true
|
79
|
+
min_server_version: 3.2
|
80
|
+
|
81
|
+
- name: existing field - does not match with array
|
82
|
+
document:
|
83
|
+
a: 20
|
84
|
+
binaryValueofA: "00010100"
|
85
|
+
query:
|
86
|
+
a:
|
87
|
+
$bitsAllClear: [0, 2]
|
88
|
+
matches: false
|
89
|
+
min_server_version: 3.2
|
90
|
+
|
91
|
+
- name: float condition representable as an integer
|
92
|
+
document:
|
93
|
+
a: 20
|
94
|
+
binaryValueofA: "00010100"
|
95
|
+
query:
|
96
|
+
a:
|
97
|
+
$bitsAllClear: 35.0
|
98
|
+
matches: true
|
99
|
+
min_server_version: 3.2
|
100
|
+
|
101
|
+
- name: float condition not representable as an integer
|
102
|
+
document:
|
103
|
+
a: 20
|
104
|
+
binaryValueofA: "00010100"
|
105
|
+
query:
|
106
|
+
a:
|
107
|
+
$bitsAllClear: 35.1
|
108
|
+
error: true
|
109
|
+
min_server_version: 3.2
|
110
|
+
|
111
|
+
- name: string condition
|
112
|
+
document:
|
113
|
+
a: 54
|
114
|
+
binaryValueofA: "00110110"
|
115
|
+
query:
|
116
|
+
a:
|
117
|
+
$bitsAllClear: hello
|
118
|
+
error: true
|
119
|
+
min_server_version: 3.2
|
120
|
+
|
121
|
+
- name: empty array condition
|
122
|
+
document:
|
123
|
+
a: 20
|
124
|
+
binaryValueofA: "00010100"
|
125
|
+
query:
|
126
|
+
a:
|
127
|
+
$bitsAllClear: []
|
128
|
+
matches: true
|
129
|
+
min_server_version: 3.2
|
130
|
+
|
131
|
+
- name: integer 0 condition
|
132
|
+
document:
|
133
|
+
a: 20
|
134
|
+
binaryValueofA: "00010100"
|
135
|
+
query:
|
136
|
+
a:
|
137
|
+
$bitsAllClear: 0
|
138
|
+
matches: true
|
139
|
+
min_server_version: 3.2
|
140
|
+
|
141
|
+
- name: negative integer condition
|
142
|
+
document:
|
143
|
+
a: 54
|
144
|
+
binaryValueofA: "00110110"
|
145
|
+
query:
|
146
|
+
a:
|
147
|
+
$bitsAllClear: -1
|
148
|
+
error: true
|
149
|
+
min_server_version: 3.2
|
150
|
+
|
151
|
+
- name: negative float condition
|
152
|
+
document:
|
153
|
+
a: 54
|
154
|
+
binaryValueofA: "00110110"
|
155
|
+
query:
|
156
|
+
a:
|
157
|
+
$bitsAllClear: -1.0
|
158
|
+
error: true
|
159
|
+
min_server_version: 3.2
|
@@ -0,0 +1,159 @@
|
|
1
|
+
- name: existing field - matches with int
|
2
|
+
document:
|
3
|
+
a: 54
|
4
|
+
binaryValueofA: "00110110"
|
5
|
+
query:
|
6
|
+
a:
|
7
|
+
$bitsAllSet: 50
|
8
|
+
matches: true
|
9
|
+
min_server_version: 3.2
|
10
|
+
|
11
|
+
- name: existing field - does not match with int
|
12
|
+
document:
|
13
|
+
a: 52
|
14
|
+
binaryValueofA: "00110100"
|
15
|
+
query:
|
16
|
+
a:
|
17
|
+
$bitsAllSet: 50
|
18
|
+
matches: false
|
19
|
+
min_server_version: 3.2
|
20
|
+
|
21
|
+
- name: existing field - matches with binData
|
22
|
+
document:
|
23
|
+
a: 54
|
24
|
+
binaryValueofA: "00110110"
|
25
|
+
query:
|
26
|
+
a:
|
27
|
+
$bitsAllSet: !ruby/object:BSON::Binary
|
28
|
+
data: !binary |-
|
29
|
+
Ng==
|
30
|
+
type: :generic
|
31
|
+
matches: true
|
32
|
+
min_server_version: 3.2
|
33
|
+
|
34
|
+
- name: existing field - does not match with binData
|
35
|
+
document:
|
36
|
+
a: 21
|
37
|
+
binaryValueofA: "00010101"
|
38
|
+
query:
|
39
|
+
a:
|
40
|
+
$bitsAllSet: !ruby/object:BSON::Binary
|
41
|
+
data: !binary |-
|
42
|
+
MC==
|
43
|
+
type: :generic
|
44
|
+
matches: false
|
45
|
+
min_server_version: 3.2
|
46
|
+
|
47
|
+
- name: existing binData field matches
|
48
|
+
document:
|
49
|
+
a: !ruby/object:BSON::Binary
|
50
|
+
data: !binary |-
|
51
|
+
Ng==
|
52
|
+
type: :generic
|
53
|
+
query:
|
54
|
+
a:
|
55
|
+
$bitsAllSet: 48
|
56
|
+
matches: true
|
57
|
+
min_server_version: 3.2
|
58
|
+
|
59
|
+
- name: existing binData field does not match
|
60
|
+
document:
|
61
|
+
a: !ruby/object:BSON::Binary
|
62
|
+
data: !binary |-
|
63
|
+
MC==
|
64
|
+
type: :generic
|
65
|
+
query:
|
66
|
+
a:
|
67
|
+
$bitsAllSet: 54
|
68
|
+
matches: false
|
69
|
+
min_server_version: 3.2
|
70
|
+
|
71
|
+
- name: existing field - matches with array
|
72
|
+
document:
|
73
|
+
a: 20
|
74
|
+
binaryValueofA: "00010100"
|
75
|
+
query:
|
76
|
+
a:
|
77
|
+
$bitsAllSet: [2, 4]
|
78
|
+
matches: true
|
79
|
+
min_server_version: 3.2
|
80
|
+
|
81
|
+
- name: existing field - does not match with array
|
82
|
+
document:
|
83
|
+
a: 20
|
84
|
+
binaryValueofA: "00010100"
|
85
|
+
query:
|
86
|
+
a:
|
87
|
+
$bitsAllSet: [0, 3]
|
88
|
+
matches: false
|
89
|
+
min_server_version: 3.2
|
90
|
+
|
91
|
+
- name: float condition representable as an integer
|
92
|
+
document:
|
93
|
+
a: 54
|
94
|
+
binaryValueofA: "00110110"
|
95
|
+
query:
|
96
|
+
a:
|
97
|
+
$bitsAllSet: 50.0
|
98
|
+
matches: true
|
99
|
+
min_server_version: 3.2
|
100
|
+
|
101
|
+
- name: float condition not representable as an integer
|
102
|
+
document:
|
103
|
+
a: 54
|
104
|
+
binaryValueofA: "00110110"
|
105
|
+
query:
|
106
|
+
a:
|
107
|
+
$bitsAllSet: 50.1
|
108
|
+
error: true
|
109
|
+
min_server_version: 3.2
|
110
|
+
|
111
|
+
- name: string condition
|
112
|
+
document:
|
113
|
+
a: 54
|
114
|
+
binaryValueofA: "00110110"
|
115
|
+
query:
|
116
|
+
a:
|
117
|
+
$bitsAllSet: hello
|
118
|
+
error: true
|
119
|
+
min_server_version: 3.2
|
120
|
+
|
121
|
+
- name: empty array condition
|
122
|
+
document:
|
123
|
+
a: 54
|
124
|
+
binaryValueofA: "00110110"
|
125
|
+
query:
|
126
|
+
a:
|
127
|
+
$bitsAllSet: []
|
128
|
+
matches: true
|
129
|
+
min_server_version: 3.2
|
130
|
+
|
131
|
+
- name: integer 0 condition
|
132
|
+
document:
|
133
|
+
a: 54
|
134
|
+
binaryValueofA: "00110110"
|
135
|
+
query:
|
136
|
+
a:
|
137
|
+
$bitsAllSet: 0
|
138
|
+
matches: true
|
139
|
+
min_server_version: 3.2
|
140
|
+
|
141
|
+
- name: negative integer condition
|
142
|
+
document:
|
143
|
+
a: 54
|
144
|
+
binaryValueofA: "00110110"
|
145
|
+
query:
|
146
|
+
a:
|
147
|
+
$bitsAllSet: -1
|
148
|
+
error: true
|
149
|
+
min_server_version: 3.2
|
150
|
+
|
151
|
+
- name: negative float condition
|
152
|
+
document:
|
153
|
+
a: 54
|
154
|
+
binaryValueofA: "00110110"
|
155
|
+
query:
|
156
|
+
a:
|
157
|
+
$bitsAllSet: -1.0
|
158
|
+
error: true
|
159
|
+
min_server_version: 3.2
|