mongoid 5.1.5 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/config/locales/en.yml +15 -0
- data/lib/mongoid.rb +5 -0
- data/lib/mongoid/attributes/dynamic.rb +3 -3
- data/lib/mongoid/clients/factory.rb +2 -0
- data/lib/mongoid/config.rb +1 -0
- data/lib/mongoid/config/options.rb +1 -1
- data/lib/mongoid/contextual/aggregable/mongo.rb +0 -1
- data/lib/mongoid/contextual/map_reduce.rb +20 -97
- data/lib/mongoid/contextual/memory.rb +1 -0
- data/lib/mongoid/contextual/mongo.rb +20 -15
- data/lib/mongoid/criteria.rb +2 -0
- data/lib/mongoid/document.rb +1 -0
- data/lib/mongoid/errors.rb +1 -0
- data/lib/mongoid/errors/in_memory_collation_not_supported.rb +20 -0
- data/lib/mongoid/errors/mongoid_error.rb +1 -1
- data/lib/mongoid/extensions.rb +1 -0
- data/lib/mongoid/extensions/decimal128.rb +39 -0
- data/lib/mongoid/fields/localized.rb +8 -3
- data/lib/mongoid/indexable/validators/options.rb +2 -1
- data/lib/mongoid/persistable/deletable.rb +3 -7
- data/lib/mongoid/persistable/settable.rb +3 -1
- data/lib/mongoid/query_cache.rb +24 -2
- data/lib/mongoid/relations/accessors.rb +1 -1
- data/lib/mongoid/relations/builders.rb +2 -2
- data/lib/mongoid/relations/eager.rb +2 -2
- data/lib/mongoid/relations/reflections.rb +5 -3
- data/lib/mongoid/relations/touchable.rb +1 -1
- data/lib/mongoid/scopable.rb +1 -1
- data/lib/mongoid/version.rb +1 -1
- data/lib/rails/generators/mongoid/config/templates/mongoid.yml +6 -2
- data/spec/app/models/band.rb +1 -0
- data/spec/config/mongoid.yml +5 -0
- data/spec/mongoid/clients/factory_spec.rb +8 -0
- data/spec/mongoid/clients_spec.rb +78 -1
- data/spec/mongoid/config_spec.rb +31 -0
- data/spec/mongoid/contextual/atomic_spec.rb +342 -76
- data/spec/mongoid/contextual/map_reduce_spec.rb +111 -119
- data/spec/mongoid/contextual/memory_spec.rb +316 -56
- data/spec/mongoid/contextual/mongo_spec.rb +391 -11
- data/spec/mongoid/criteria_spec.rb +21 -2
- data/spec/mongoid/extensions/decimal128_spec.rb +44 -0
- data/spec/mongoid/extensions/time_spec.rb +2 -2
- data/spec/mongoid/fields/localized_spec.rb +91 -0
- data/spec/mongoid/indexable_spec.rb +44 -0
- data/spec/mongoid/persistable/settable_spec.rb +44 -0
- data/spec/mongoid/query_cache_spec.rb +86 -0
- data/spec/mongoid/relations/cyclic_spec.rb +22 -0
- data/spec/mongoid/relations/referenced/many_spec.rb +11 -0
- data/spec/mongoid/relations/referenced/many_to_many_spec.rb +11 -0
- data/spec/mongoid/relations/reflections_spec.rb +9 -9
- data/spec/mongoid/scopable_spec.rb +12 -0
- data/spec/spec_helper.rb +9 -0
- metadata +26 -16
- metadata.gz.sig +0 -0
@@ -2936,6 +2936,17 @@ describe Mongoid::Relations::Referenced::Many do
|
|
2936
2936
|
end
|
2937
2937
|
end
|
2938
2938
|
|
2939
|
+
context 'when providing a collation', if: collation_supported? do
|
2940
|
+
|
2941
|
+
let(:posts) do
|
2942
|
+
person.posts.where(title: "FIRST").collation(locale: 'en_US', strength: 2)
|
2943
|
+
end
|
2944
|
+
|
2945
|
+
it "applies the collation option to the query" do
|
2946
|
+
expect(posts).to eq([ post_one ])
|
2947
|
+
end
|
2948
|
+
end
|
2949
|
+
|
2939
2950
|
context "when providing a criteria class method" do
|
2940
2951
|
|
2941
2952
|
let(:posts) do
|
@@ -2654,6 +2654,17 @@ describe Mongoid::Relations::Referenced::ManyToMany do
|
|
2654
2654
|
end
|
2655
2655
|
end
|
2656
2656
|
|
2657
|
+
context 'when providing a collation', if: collation_supported? do
|
2658
|
+
|
2659
|
+
let(:preferences) do
|
2660
|
+
person.preferences.where(name: "FIRST").collation(locale: 'en_US', strength: 2).to_a
|
2661
|
+
end
|
2662
|
+
|
2663
|
+
it "applies the collation option to the query" do
|
2664
|
+
expect(preferences).to eq([ preference_one ])
|
2665
|
+
end
|
2666
|
+
end
|
2667
|
+
|
2657
2668
|
context "when providing a criteria on id" do
|
2658
2669
|
|
2659
2670
|
let(:preferences) do
|
@@ -74,23 +74,23 @@ describe Mongoid::Relations::Reflections do
|
|
74
74
|
expect(relations.size).to eq(1)
|
75
75
|
end
|
76
76
|
end
|
77
|
-
end
|
78
77
|
|
79
|
-
|
78
|
+
context "when no argument supplied" do
|
80
79
|
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
let(:relations) do
|
81
|
+
klass.reflect_on_all_associations
|
82
|
+
end
|
84
83
|
|
85
|
-
|
86
|
-
|
84
|
+
it "returns an array of all relations" do
|
85
|
+
expect(relations.size).to eq(3)
|
86
|
+
end
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
context "when no
|
90
|
+
context "when no relations exist for the macros" do
|
91
91
|
|
92
92
|
let(:relations) do
|
93
|
-
klass.reflect_on_all_associations
|
93
|
+
klass.reflect_on_all_associations(:embeds_one)
|
94
94
|
end
|
95
95
|
|
96
96
|
it "returns an empty array" do
|
@@ -227,6 +227,18 @@ describe Mongoid::Scopable do
|
|
227
227
|
|
228
228
|
context "when provided a criteria" do
|
229
229
|
|
230
|
+
context 'when a collation is defined on the criteria', if: collation_supported? do
|
231
|
+
|
232
|
+
before do
|
233
|
+
Band.scope(:tests, ->{ Band.where(name: 'TESTING').collation(locale: 'en_US', strength: 2) })
|
234
|
+
Band.create(name: 'testing')
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'applies the collation' do
|
238
|
+
expect(Band.tests.first['name']).to eq('testing')
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
230
242
|
context "when the lambda includes a geo_near query" do
|
231
243
|
|
232
244
|
before do
|
data/spec/spec_helper.rb
CHANGED
@@ -75,11 +75,20 @@ def testing_locally?
|
|
75
75
|
!(ENV['CI'] == 'travis')
|
76
76
|
end
|
77
77
|
|
78
|
+
def testing_replica_set?
|
79
|
+
Mongoid::Clients.default.cluster.replica_set?
|
80
|
+
end
|
81
|
+
|
78
82
|
# Set the database that the spec suite connects to.
|
79
83
|
Mongoid.configure do |config|
|
80
84
|
config.load_configuration(CONFIG)
|
81
85
|
end
|
82
86
|
|
87
|
+
def collation_supported?
|
88
|
+
Mongoid::Clients.default.cluster.next_primary.features.collation_enabled?
|
89
|
+
end
|
90
|
+
alias :decimal128_supported? :collation_supported?
|
91
|
+
|
83
92
|
# Autoload every model for the test suite that sits in spec/app/models.
|
84
93
|
Dir[ File.join(MODELS, "*.rb") ].sort.each do |file|
|
85
94
|
name = File.basename(file, ".rb")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Durran Jordan
|
@@ -12,7 +12,7 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtkcml2
|
14
14
|
ZXItcnVieTEVMBMGCgmSJomT8ixkARkWBTEwZ2VuMRMwEQYKCZImiZPyLGQBGRYD
|
15
|
-
|
15
|
+
Y29tMB4XDTE2MTIwMTE0MDcxMloXDTE3MTIwMTE0MDcxMlowQjEUMBIGA1UEAwwL
|
16
16
|
ZHJpdmVyLXJ1YnkxFTATBgoJkiaJk/IsZAEZFgUxMGdlbjETMBEGCgmSJomT8ixk
|
17
17
|
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANFdSAa8fRm1
|
18
18
|
bAM9za6Z0fAH4g02bqM1NGnw8zJQrE/PFrFfY6IFCT2AsLfOwr1maVm7iU1+kdVI
|
@@ -23,14 +23,14 @@ cert_chain:
|
|
23
23
|
u8KAcPHm5KkCAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
24
24
|
BBYEFFt3WbF+9JpUjAoj62cQBgNb8HzXMCAGA1UdEQQZMBeBFWRyaXZlci1ydWJ5
|
25
25
|
QDEwZ2VuLmNvbTAgBgNVHRIEGTAXgRVkcml2ZXItcnVieUAxMGdlbi5jb20wDQYJ
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
KoZIhvcNAQEFBQADggEBAKBDaVkycCUC1zMfpAkXIgWtji2Nr2ZygYQR53AgxOaE
|
27
|
+
7nqxdh5Lh8pnfwa71/ucrZFJt+g/mEhen9lFNmcizvpP43Hh4rYf8j6T8Y+mQ6tr
|
28
|
+
sp5xWiv93DlLXGmas0hv9VRYDvV1vLFaG05FHOAZKdo6pD2t6jNyMSAn4fMHKctw
|
29
|
+
UoYN5FLt84jacRQF5nhy9gBhfgvA19LcjeMLQC11x3fykDLzCXF2wEe5Q5iYaWvb
|
30
|
+
cGiNQIiHBj/9/xHfOyOthBPUevTiVnuffarDr434z/LGLwYzgaG5EcJFvZqpvUpP
|
31
|
+
fGcAPtAZUMGLXwcOB1BJEFkDxUQIJiEpSmf4YzzZhEM=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2017-01-26 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: activemodel
|
@@ -64,30 +64,36 @@ dependencies:
|
|
64
64
|
name: mongo
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.4.1
|
70
|
+
- - "<"
|
68
71
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
72
|
+
version: 3.0.0
|
70
73
|
type: :runtime
|
71
74
|
prerelease: false
|
72
75
|
version_requirements: !ruby/object:Gem::Requirement
|
73
76
|
requirements:
|
74
|
-
- - "
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 2.4.1
|
80
|
+
- - "<"
|
75
81
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
82
|
+
version: 3.0.0
|
77
83
|
- !ruby/object:Gem::Dependency
|
78
84
|
name: origin
|
79
85
|
requirement: !ruby/object:Gem::Requirement
|
80
86
|
requirements:
|
81
87
|
- - "~>"
|
82
88
|
- !ruby/object:Gem::Version
|
83
|
-
version: '2.
|
89
|
+
version: '2.3'
|
84
90
|
type: :runtime
|
85
91
|
prerelease: false
|
86
92
|
version_requirements: !ruby/object:Gem::Requirement
|
87
93
|
requirements:
|
88
94
|
- - "~>"
|
89
95
|
- !ruby/object:Gem::Version
|
90
|
-
version: '2.
|
96
|
+
version: '2.3'
|
91
97
|
description: Mongoid is an ODM (Object Document Mapper) Framework for MongoDB, written
|
92
98
|
in Ruby.
|
93
99
|
email:
|
@@ -158,6 +164,7 @@ files:
|
|
158
164
|
- lib/mongoid/errors/document_not_destroyed.rb
|
159
165
|
- lib/mongoid/errors/document_not_found.rb
|
160
166
|
- lib/mongoid/errors/eager_load.rb
|
167
|
+
- lib/mongoid/errors/in_memory_collation_not_supported.rb
|
161
168
|
- lib/mongoid/errors/invalid_collection.rb
|
162
169
|
- lib/mongoid/errors/invalid_config_option.rb
|
163
170
|
- lib/mongoid/errors/invalid_field.rb
|
@@ -202,6 +209,7 @@ files:
|
|
202
209
|
- lib/mongoid/extensions/boolean.rb
|
203
210
|
- lib/mongoid/extensions/date.rb
|
204
211
|
- lib/mongoid/extensions/date_time.rb
|
212
|
+
- lib/mongoid/extensions/decimal128.rb
|
205
213
|
- lib/mongoid/extensions/false_class.rb
|
206
214
|
- lib/mongoid/extensions/float.rb
|
207
215
|
- lib/mongoid/extensions/hash.rb
|
@@ -651,6 +659,7 @@ files:
|
|
651
659
|
- spec/mongoid/extensions/boolean_spec.rb
|
652
660
|
- spec/mongoid/extensions/date_spec.rb
|
653
661
|
- spec/mongoid/extensions/date_time_spec.rb
|
662
|
+
- spec/mongoid/extensions/decimal128_spec.rb
|
654
663
|
- spec/mongoid/extensions/false_class_spec.rb
|
655
664
|
- spec/mongoid/extensions/float_spec.rb
|
656
665
|
- spec/mongoid/extensions/hash_spec.rb
|
@@ -812,7 +821,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
812
821
|
version: 1.3.6
|
813
822
|
requirements: []
|
814
823
|
rubyforge_project: mongoid
|
815
|
-
rubygems_version: 2.5.1
|
824
|
+
rubygems_version: 2.4.5.1
|
816
825
|
signing_key:
|
817
826
|
specification_version: 4
|
818
827
|
summary: Elegant Persistence in Ruby for MongoDB.
|
@@ -1107,6 +1116,7 @@ test_files:
|
|
1107
1116
|
- spec/mongoid/extensions/boolean_spec.rb
|
1108
1117
|
- spec/mongoid/extensions/date_spec.rb
|
1109
1118
|
- spec/mongoid/extensions/date_time_spec.rb
|
1119
|
+
- spec/mongoid/extensions/decimal128_spec.rb
|
1110
1120
|
- spec/mongoid/extensions/false_class_spec.rb
|
1111
1121
|
- spec/mongoid/extensions/float_spec.rb
|
1112
1122
|
- spec/mongoid/extensions/hash_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|