mongoid 8.0.1 → 8.0.2
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/lib/config/locales/en.yml +1 -0
- data/lib/mongoid/association/accessors.rb +6 -6
- data/lib/mongoid/association/bindable.rb +2 -2
- data/lib/mongoid/association/constrainable.rb +0 -1
- data/lib/mongoid/association/embedded/batchable.rb +5 -5
- data/lib/mongoid/association/embedded/cyclic.rb +1 -1
- data/lib/mongoid/association/embedded/embedded_in/proxy.rb +2 -2
- data/lib/mongoid/association/embedded/embedded_in.rb +1 -1
- data/lib/mongoid/association/embedded/embeds_many/proxy.rb +10 -10
- data/lib/mongoid/association/embedded/embeds_many.rb +2 -2
- data/lib/mongoid/association/embedded/embeds_one/proxy.rb +2 -2
- data/lib/mongoid/association/embedded/embeds_one.rb +3 -3
- data/lib/mongoid/association/many.rb +6 -7
- data/lib/mongoid/association/nested/many.rb +3 -3
- data/lib/mongoid/association/nested/nested_buildable.rb +4 -4
- data/lib/mongoid/association/nested/one.rb +5 -5
- data/lib/mongoid/association/one.rb +2 -2
- data/lib/mongoid/association/options.rb +9 -9
- data/lib/mongoid/association/proxy.rb +2 -3
- data/lib/mongoid/association/referenced/auto_save.rb +1 -1
- data/lib/mongoid/association/referenced/belongs_to/proxy.rb +5 -6
- data/lib/mongoid/association/referenced/belongs_to.rb +1 -1
- data/lib/mongoid/association/referenced/counter_cache.rb +2 -2
- data/lib/mongoid/association/referenced/eager.rb +2 -2
- data/lib/mongoid/association/referenced/has_and_belongs_to_many/proxy.rb +2 -2
- data/lib/mongoid/association/referenced/has_and_belongs_to_many.rb +2 -2
- data/lib/mongoid/association/referenced/has_many/enumerable.rb +10 -10
- data/lib/mongoid/association/referenced/has_many/proxy.rb +12 -9
- data/lib/mongoid/association/referenced/has_many.rb +3 -3
- data/lib/mongoid/association/referenced/has_one/nested_builder.rb +5 -5
- data/lib/mongoid/association/referenced/has_one/proxy.rb +1 -1
- data/lib/mongoid/association/referenced/has_one.rb +3 -3
- data/lib/mongoid/association/referenced/syncable.rb +2 -2
- data/lib/mongoid/association/reflections.rb +2 -2
- data/lib/mongoid/association/relatable.rb +6 -6
- data/lib/mongoid/association.rb +5 -5
- data/lib/mongoid/atomic/modifiers.rb +2 -2
- data/lib/mongoid/attributes/dynamic.rb +3 -3
- data/lib/mongoid/attributes/nested.rb +5 -5
- data/lib/mongoid/attributes/processing.rb +1 -1
- data/lib/mongoid/attributes/projector.rb +1 -1
- data/lib/mongoid/attributes/readonly.rb +2 -2
- data/lib/mongoid/attributes.rb +13 -13
- data/lib/mongoid/changeable.rb +5 -5
- data/lib/mongoid/clients/options.rb +1 -1
- data/lib/mongoid/clients/validators/storage.rb +3 -3
- data/lib/mongoid/config/validators/client.rb +6 -6
- data/lib/mongoid/config.rb +7 -7
- data/lib/mongoid/contextual/aggregable/memory.rb +1 -1
- data/lib/mongoid/contextual/aggregable/mongo.rb +4 -4
- data/lib/mongoid/contextual/aggregable/none.rb +1 -1
- data/lib/mongoid/contextual/atomic.rb +1 -1
- data/lib/mongoid/contextual/geo_near.rb +7 -7
- data/lib/mongoid/contextual/memory.rb +5 -5
- data/lib/mongoid/contextual/mongo.rb +14 -14
- data/lib/mongoid/contextual/none.rb +2 -2
- data/lib/mongoid/contextual/queryable.rb +1 -1
- data/lib/mongoid/contextual.rb +2 -2
- data/lib/mongoid/criteria/findable.rb +7 -4
- data/lib/mongoid/criteria/includable.rb +1 -1
- data/lib/mongoid/criteria/permission.rb +1 -1
- data/lib/mongoid/criteria/queryable/aggregable.rb +2 -2
- data/lib/mongoid/criteria/queryable/extensions/boolean.rb +1 -1
- data/lib/mongoid/criteria/queryable/extensions/regexp.rb +2 -2
- data/lib/mongoid/criteria/queryable/extensions/set.rb +1 -1
- data/lib/mongoid/criteria/queryable/extensions/string.rb +3 -3
- data/lib/mongoid/criteria/queryable/extensions/symbol.rb +1 -1
- data/lib/mongoid/criteria/queryable/key.rb +3 -3
- data/lib/mongoid/criteria/queryable/optional.rb +2 -2
- data/lib/mongoid/criteria/queryable/options.rb +1 -1
- data/lib/mongoid/criteria/queryable/pipeline.rb +1 -1
- data/lib/mongoid/criteria/queryable/selectable.rb +3 -3
- data/lib/mongoid/criteria/queryable/selector.rb +3 -3
- data/lib/mongoid/criteria/queryable/smash.rb +1 -1
- data/lib/mongoid/criteria/queryable.rb +1 -1
- data/lib/mongoid/criteria/scopable.rb +2 -2
- data/lib/mongoid/criteria.rb +14 -9
- data/lib/mongoid/deprecable.rb +1 -1
- data/lib/mongoid/document.rb +2 -2
- data/lib/mongoid/equality.rb +12 -12
- data/lib/mongoid/errors/document_not_found.rb +5 -5
- data/lib/mongoid/errors/invalid_config_option.rb +1 -1
- data/lib/mongoid/errors/invalid_dependent_strategy.rb +1 -1
- data/lib/mongoid/errors/invalid_field.rb +1 -1
- data/lib/mongoid/errors/invalid_relation.rb +1 -1
- data/lib/mongoid/errors/invalid_relation_option.rb +1 -1
- data/lib/mongoid/errors/invalid_session_use.rb +1 -1
- data/lib/mongoid/errors/invalid_storage_options.rb +1 -1
- data/lib/mongoid/errors/mongoid_error.rb +3 -3
- data/lib/mongoid/errors/nested_attributes_metadata_not_found.rb +1 -1
- data/lib/mongoid/errors/no_client_database.rb +1 -1
- data/lib/mongoid/errors/no_client_hosts.rb +1 -1
- data/lib/mongoid/errors/readonly_attribute.rb +1 -1
- data/lib/mongoid/errors/unknown_attribute.rb +1 -1
- data/lib/mongoid/extensions/array.rb +1 -1
- data/lib/mongoid/extensions/false_class.rb +1 -1
- data/lib/mongoid/extensions/hash.rb +1 -1
- data/lib/mongoid/extensions/module.rb +1 -1
- data/lib/mongoid/extensions/object.rb +6 -6
- data/lib/mongoid/extensions/string.rb +9 -9
- data/lib/mongoid/extensions/symbol.rb +1 -1
- data/lib/mongoid/extensions/true_class.rb +1 -1
- data/lib/mongoid/fields/foreign_key.rb +4 -4
- data/lib/mongoid/fields/localized.rb +2 -2
- data/lib/mongoid/fields/standard.rb +7 -7
- data/lib/mongoid/fields.rb +9 -9
- data/lib/mongoid/findable.rb +7 -6
- data/lib/mongoid/indexable/specification.rb +1 -1
- data/lib/mongoid/indexable/validators/options.rb +2 -1
- data/lib/mongoid/interceptable.rb +4 -4
- data/lib/mongoid/matchable.rb +1 -1
- data/lib/mongoid/matcher.rb +12 -7
- data/lib/mongoid/persistable/creatable.rb +4 -4
- data/lib/mongoid/persistable/deletable.rb +1 -1
- data/lib/mongoid/persistable/destroyable.rb +1 -1
- data/lib/mongoid/persistable/savable.rb +2 -2
- data/lib/mongoid/persistable/unsettable.rb +1 -1
- data/lib/mongoid/persistable/updatable.rb +7 -7
- data/lib/mongoid/persistable/upsertable.rb +1 -1
- data/lib/mongoid/persistable.rb +3 -3
- data/lib/mongoid/persistence_context.rb +3 -3
- data/lib/mongoid/query_cache.rb +2 -2
- data/lib/mongoid/scopable.rb +17 -15
- data/lib/mongoid/serializable.rb +10 -6
- data/lib/mongoid/stateful.rb +10 -10
- data/lib/mongoid/tasks/database.rb +0 -2
- data/lib/mongoid/threaded/lifecycle.rb +5 -5
- data/lib/mongoid/threaded.rb +9 -9
- data/lib/mongoid/timestamps/updated.rb +1 -1
- data/lib/mongoid/traversable.rb +3 -3
- data/lib/mongoid/validatable/localizable.rb +1 -1
- data/lib/mongoid/validatable/macros.rb +0 -2
- data/lib/mongoid/validatable/presence.rb +2 -2
- data/lib/mongoid/validatable/uniqueness.rb +7 -7
- data/lib/mongoid/validatable.rb +6 -6
- data/lib/mongoid/version.rb +1 -1
- data/spec/mongoid/equality_spec.rb +12 -12
- data/spec/mongoid/indexable_spec.rb +23 -1
- data/spec/mongoid/scopable_spec.rb +34 -16
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
@@ -223,8 +223,11 @@ describe Mongoid::Indexable do
|
|
223
223
|
let(:klass) do
|
224
224
|
Class.new do
|
225
225
|
include Mongoid::Document
|
226
|
-
|
226
|
+
|
227
227
|
store_in collection: :specs
|
228
|
+
|
229
|
+
field :a, as: :authentication_token
|
230
|
+
field :username
|
228
231
|
end
|
229
232
|
end
|
230
233
|
|
@@ -588,6 +591,25 @@ describe Mongoid::Indexable do
|
|
588
591
|
end
|
589
592
|
end
|
590
593
|
|
594
|
+
context "when using a wildcard index" do
|
595
|
+
|
596
|
+
before do
|
597
|
+
klass.index({ '$**': 1 }, wildcard_projection: { _id: 1, username: 0 })
|
598
|
+
end
|
599
|
+
|
600
|
+
let(:spec) do
|
601
|
+
klass.index_specification('$**': 1)
|
602
|
+
end
|
603
|
+
|
604
|
+
it "creates the index" do
|
605
|
+
expect(spec).to be_a(Mongoid::Indexable::Specification)
|
606
|
+
end
|
607
|
+
|
608
|
+
it "sets the index with correct options" do
|
609
|
+
expect(spec.options).to eq(wildcard_projection: { _id: 1, username: 0 })
|
610
|
+
end
|
611
|
+
end
|
612
|
+
|
591
613
|
context "when providing an invalid option" do
|
592
614
|
|
593
615
|
it "raises an error" do
|
@@ -481,27 +481,45 @@ describe Mongoid::Scopable do
|
|
481
481
|
|
482
482
|
context "when a block is provided" do
|
483
483
|
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
484
|
+
context "when with optional and keyword arguments" do
|
485
|
+
before do
|
486
|
+
Band.scope(:named_by, ->(name, deleted: false) {
|
487
|
+
Band.where(name: name, deleted: deleted)
|
488
|
+
})
|
489
489
|
end
|
490
|
-
end
|
491
490
|
|
492
|
-
|
493
|
-
|
494
|
-
undef_method :active
|
491
|
+
let(:scope) do
|
492
|
+
Band.named_by("Emily", deleted: true)
|
495
493
|
end
|
496
|
-
Band._declared_scopes.clear
|
497
|
-
end
|
498
494
|
|
499
|
-
|
500
|
-
|
495
|
+
it "sets the conditions from keyword arguments" do
|
496
|
+
scope.selector.should == {'name' => 'Emily', 'deleted' => true}
|
497
|
+
end
|
501
498
|
end
|
502
499
|
|
503
|
-
|
504
|
-
|
500
|
+
context "when without arguments" do
|
501
|
+
before do
|
502
|
+
Band.scope(:active, ->{ Band.where(active: true) }) do
|
503
|
+
def add_origin
|
504
|
+
tap { |c| c.selector[:origin] = "Deutschland" }
|
505
|
+
end
|
506
|
+
end
|
507
|
+
end
|
508
|
+
|
509
|
+
after do
|
510
|
+
class << Band
|
511
|
+
undef_method :active
|
512
|
+
end
|
513
|
+
Band._declared_scopes.clear
|
514
|
+
end
|
515
|
+
|
516
|
+
let(:scope) do
|
517
|
+
Band.active.add_origin
|
518
|
+
end
|
519
|
+
|
520
|
+
it "adds the extension to the scope" do
|
521
|
+
expect(scope.selector).to eq({ "active" => true, "origin" => "Deutschland" })
|
522
|
+
end
|
505
523
|
end
|
506
524
|
end
|
507
525
|
|
@@ -1173,7 +1191,7 @@ describe Mongoid::Scopable do
|
|
1173
1191
|
end
|
1174
1192
|
end
|
1175
1193
|
|
1176
|
-
context 'when nesting
|
1194
|
+
context 'when nesting unscoped under with_scope' do
|
1177
1195
|
let(:c1) { Band.where(active: true) }
|
1178
1196
|
|
1179
1197
|
it 'restores previous scope' do
|
data.tar.gz.sig
CHANGED
Binary file
|
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: 8.0.
|
4
|
+
version: 8.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Durran Jordan
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
+WyKQ+QTIdtDiyf2LQmxWnxt/W1CmScjdLS7/yXGkkB/D9Uy+sJD747O/B9P238Q
|
31
31
|
XnerrtyOu04RsWDvaZkCwSDVzoqfICh4CP1mlde73Ts=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2022-07-
|
33
|
+
date: 2022-07-23 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: activemodel
|
metadata.gz.sig
CHANGED
Binary file
|