mongoid 7.2.6 → 7.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/Rakefile +16 -0
  4. data/lib/config/locales/en.yml +2 -2
  5. data/lib/mongoid/association/accessors.rb +13 -1
  6. data/lib/mongoid/association/constrainable.rb +1 -1
  7. data/lib/mongoid/association/depending.rb +4 -4
  8. data/lib/mongoid/association/embedded/batchable.rb +1 -1
  9. data/lib/mongoid/association/embedded/embedded_in.rb +1 -1
  10. data/lib/mongoid/association/embedded/embeds_many/proxy.rb +10 -3
  11. data/lib/mongoid/association/nested/many.rb +1 -1
  12. data/lib/mongoid/association/nested/one.rb +4 -2
  13. data/lib/mongoid/association/proxy.rb +6 -1
  14. data/lib/mongoid/association/referenced/auto_save.rb +2 -2
  15. data/lib/mongoid/association/referenced/has_many/enumerable.rb +490 -496
  16. data/lib/mongoid/association/referenced/has_many/proxy.rb +2 -2
  17. data/lib/mongoid/association/referenced/has_one/nested_builder.rb +2 -2
  18. data/lib/mongoid/atomic.rb +26 -2
  19. data/lib/mongoid/attributes/projector.rb +120 -0
  20. data/lib/mongoid/attributes.rb +24 -13
  21. data/lib/mongoid/cacheable.rb +2 -2
  22. data/lib/mongoid/clients/factory.rb +22 -8
  23. data/lib/mongoid/clients.rb +1 -1
  24. data/lib/mongoid/config.rb +19 -2
  25. data/lib/mongoid/contextual/aggregable/mongo.rb +10 -8
  26. data/lib/mongoid/copyable.rb +1 -1
  27. data/lib/mongoid/criteria/findable.rb +1 -1
  28. data/lib/mongoid/criteria/queryable/expandable.rb +0 -24
  29. data/lib/mongoid/criteria/queryable/extensions/boolean.rb +1 -1
  30. data/lib/mongoid/criteria/queryable/extensions.rb +0 -4
  31. data/lib/mongoid/criteria/queryable/mergeable.rb +46 -20
  32. data/lib/mongoid/criteria/queryable/selectable.rb +8 -8
  33. data/lib/mongoid/criteria.rb +4 -5
  34. data/lib/mongoid/document.rb +1 -15
  35. data/lib/mongoid/errors/delete_restriction.rb +8 -9
  36. data/lib/mongoid/evolvable.rb +1 -1
  37. data/lib/mongoid/extensions/boolean.rb +1 -2
  38. data/lib/mongoid/extensions/false_class.rb +1 -1
  39. data/lib/mongoid/extensions/hash.rb +2 -2
  40. data/lib/mongoid/extensions/true_class.rb +1 -1
  41. data/lib/mongoid/fields.rb +43 -5
  42. data/lib/mongoid/inspectable.rb +1 -1
  43. data/lib/mongoid/matcher/bits.rb +41 -0
  44. data/lib/mongoid/matcher/bits_all_clear.rb +20 -0
  45. data/lib/mongoid/matcher/bits_all_set.rb +20 -0
  46. data/lib/mongoid/matcher/bits_any_clear.rb +20 -0
  47. data/lib/mongoid/matcher/bits_any_set.rb +20 -0
  48. data/lib/mongoid/matcher/expression.rb +4 -0
  49. data/lib/mongoid/matcher/field_operator.rb +6 -0
  50. data/lib/mongoid/matcher/mod.rb +17 -0
  51. data/lib/mongoid/matcher/type.rb +99 -0
  52. data/lib/mongoid/matcher.rb +7 -0
  53. data/lib/mongoid/persistable/deletable.rb +1 -2
  54. data/lib/mongoid/persistable/destroyable.rb +8 -2
  55. data/lib/mongoid/persistable/updatable.rb +27 -2
  56. data/lib/mongoid/query_cache.rb +35 -29
  57. data/lib/mongoid/selectable.rb +5 -7
  58. data/lib/mongoid/shardable.rb +21 -5
  59. data/lib/mongoid/touchable.rb +33 -4
  60. data/lib/mongoid/version.rb +1 -1
  61. data/spec/integration/associations/embeds_many_spec.rb +44 -0
  62. data/spec/integration/associations/has_one_spec.rb +48 -0
  63. data/spec/integration/criteria/date_field_spec.rb +1 -1
  64. data/spec/integration/document_spec.rb +9 -0
  65. data/spec/integration/matcher_operator_data/bits_all_clear.yml +159 -0
  66. data/spec/integration/matcher_operator_data/bits_all_set.yml +159 -0
  67. data/spec/integration/matcher_operator_data/bits_any_clear.yml +159 -0
  68. data/spec/integration/matcher_operator_data/bits_any_set.yml +159 -0
  69. data/spec/integration/matcher_operator_data/comment.yml +22 -0
  70. data/spec/integration/matcher_operator_data/in.yml +16 -0
  71. data/spec/integration/matcher_operator_data/mod.yml +55 -0
  72. data/spec/integration/matcher_operator_data/type.yml +70 -0
  73. data/spec/integration/matcher_operator_data/type_array.yml +16 -0
  74. data/spec/integration/matcher_operator_data/type_binary.yml +18 -0
  75. data/spec/integration/matcher_operator_data/type_boolean.yml +39 -0
  76. data/spec/integration/matcher_operator_data/type_code.yml +26 -0
  77. data/spec/integration/matcher_operator_data/type_code_with_scope.yml +26 -0
  78. data/spec/integration/matcher_operator_data/type_date.yml +39 -0
  79. data/spec/integration/matcher_operator_data/type_db_pointer.yml +19 -0
  80. data/spec/integration/matcher_operator_data/type_decimal.yml +40 -0
  81. data/spec/integration/matcher_operator_data/type_double.yml +15 -0
  82. data/spec/integration/matcher_operator_data/type_int32.yml +33 -0
  83. data/spec/integration/matcher_operator_data/type_int64.yml +33 -0
  84. data/spec/integration/matcher_operator_data/type_max_key.yml +17 -0
  85. data/spec/integration/matcher_operator_data/type_min_key.yml +17 -0
  86. data/spec/integration/matcher_operator_data/type_null.yml +23 -0
  87. data/spec/integration/matcher_operator_data/type_object.yml +23 -0
  88. data/spec/integration/matcher_operator_data/type_object_id.yml +25 -0
  89. data/spec/integration/matcher_operator_data/type_regex.yml +44 -0
  90. data/spec/integration/matcher_operator_data/type_string.yml +15 -0
  91. data/spec/integration/matcher_operator_data/type_symbol.yml +32 -0
  92. data/spec/integration/matcher_operator_data/type_timestamp.yml +25 -0
  93. data/spec/integration/matcher_operator_data/type_undefined.yml +17 -0
  94. data/spec/lite_spec_helper.rb +2 -0
  95. data/spec/mongoid/association/depending_spec.rb +391 -352
  96. data/spec/mongoid/association/nested/one_spec.rb +18 -14
  97. data/spec/mongoid/association/referenced/belongs_to/proxy_spec.rb +25 -8
  98. data/spec/mongoid/association/referenced/has_and_belongs_to_many/binding_spec.rb +1 -1
  99. data/spec/mongoid/association/referenced/has_many/binding_spec.rb +1 -1
  100. data/spec/mongoid/association/referenced/has_many/enumerable_spec.rb +245 -93
  101. data/spec/mongoid/association/referenced/has_many/proxy_spec.rb +6 -6
  102. data/spec/mongoid/association/referenced/has_one_models.rb +8 -0
  103. data/spec/mongoid/atomic/paths_spec.rb +64 -12
  104. data/spec/mongoid/attributes/projector_data/embedded.yml +105 -0
  105. data/spec/mongoid/attributes/projector_data/fields.yml +93 -0
  106. data/spec/mongoid/attributes/projector_spec.rb +41 -0
  107. data/spec/mongoid/attributes_spec.rb +98 -6
  108. data/spec/mongoid/clients/factory_spec.rb +48 -0
  109. data/spec/mongoid/config_spec.rb +106 -1
  110. data/spec/mongoid/contextual/mongo_spec.rb +2 -2
  111. data/spec/mongoid/criteria/modifiable_spec.rb +1 -1
  112. data/spec/mongoid/criteria/queryable/expandable_spec.rb +0 -73
  113. data/spec/mongoid/criteria/queryable/extensions/boolean_spec.rb +1 -1
  114. data/spec/mongoid/criteria/queryable/mergeable_spec.rb +105 -7
  115. data/spec/mongoid/criteria/queryable/selectable_logical_spec.rb +229 -24
  116. data/spec/mongoid/criteria/queryable/selectable_shared_examples.rb +39 -0
  117. data/spec/mongoid/criteria/queryable/selectable_spec.rb +1 -565
  118. data/spec/mongoid/criteria/queryable/selectable_where_spec.rb +590 -0
  119. data/spec/mongoid/criteria_projection_spec.rb +411 -0
  120. data/spec/mongoid/criteria_spec.rb +0 -275
  121. data/spec/mongoid/document_spec.rb +13 -13
  122. data/spec/mongoid/errors/delete_restriction_spec.rb +1 -1
  123. data/spec/mongoid/extensions/false_class_spec.rb +1 -1
  124. data/spec/mongoid/extensions/string_spec.rb +5 -5
  125. data/spec/mongoid/extensions/true_class_spec.rb +1 -1
  126. data/spec/mongoid/fields/localized_spec.rb +4 -4
  127. data/spec/mongoid/fields_spec.rb +4 -4
  128. data/spec/mongoid/inspectable_spec.rb +12 -4
  129. data/spec/mongoid/persistable/deletable_spec.rb +175 -1
  130. data/spec/mongoid/persistable/destroyable_spec.rb +191 -3
  131. data/spec/mongoid/persistable/savable_spec.rb +3 -5
  132. data/spec/mongoid/persistable/upsertable_spec.rb +1 -1
  133. data/spec/mongoid/query_cache_middleware_spec.rb +8 -0
  134. data/spec/mongoid/reloadable_spec.rb +18 -1
  135. data/spec/mongoid/shardable_spec.rb +44 -0
  136. data/spec/mongoid/touchable_spec.rb +122 -16
  137. data/spec/mongoid/touchable_spec_models.rb +54 -0
  138. data/spec/mongoid/validatable_spec.rb +1 -1
  139. data/spec/spec_helper.rb +6 -2
  140. data/spec/support/client_registry.rb +9 -0
  141. data/spec/support/models/bolt.rb +8 -0
  142. data/spec/support/models/hole.rb +13 -0
  143. data/spec/support/models/mop.rb +0 -1
  144. data/spec/support/models/nut.rb +8 -0
  145. data/spec/support/models/person.rb +6 -0
  146. data/spec/support/models/sealer.rb +8 -0
  147. data/spec/support/models/shirt.rb +12 -0
  148. data/spec/support/models/spacer.rb +8 -0
  149. data/spec/support/models/threadlocker.rb +8 -0
  150. data/spec/support/models/washer.rb +8 -0
  151. data.tar.gz.sig +0 -0
  152. metadata +97 -3
  153. metadata.gz.sig +0 -0
  154. data/spec/support/cluster_config.rb +0 -158
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
4
+ class Nut
5
+ include Mongoid::Document
6
+
7
+ belongs_to :hole
8
+ end
@@ -219,6 +219,12 @@ class Person
219
219
  reset_callbacks(:create)
220
220
  reset_callbacks(:save)
221
221
  reset_callbacks(:destroy)
222
+
223
+ private
224
+
225
+ def secret_name
226
+ "secret"
227
+ end
222
228
  end
223
229
 
224
230
  require "support/models/doctor"
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
4
+ class Sealer
5
+ include Mongoid::Document
6
+
7
+ belongs_to :hole
8
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
4
+ class Shirt
5
+ include Mongoid::Document
6
+
7
+ field :color, type: String
8
+
9
+ unalias_attribute :id
10
+
11
+ field :id, type: String
12
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
4
+ class Spacer
5
+ include Mongoid::Document
6
+
7
+ belongs_to :hole
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
4
+ class Threadlocker
5
+ include Mongoid::Document
6
+
7
+ belongs_to :hole
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
4
+ class Washer
5
+ include Mongoid::Document
6
+
7
+ belongs_to :hole
8
+ end
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: 7.2.6
4
+ version: 7.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Durran Jordan
@@ -190,6 +190,7 @@ files:
190
190
  - lib/mongoid/attributes/dynamic.rb
191
191
  - lib/mongoid/attributes/nested.rb
192
192
  - lib/mongoid/attributes/processing.rb
193
+ - lib/mongoid/attributes/projector.rb
193
194
  - lib/mongoid/attributes/readonly.rb
194
195
  - lib/mongoid/cacheable.rb
195
196
  - lib/mongoid/changeable.rb
@@ -362,6 +363,11 @@ files:
362
363
  - lib/mongoid/matcher.rb
363
364
  - lib/mongoid/matcher/all.rb
364
365
  - lib/mongoid/matcher/and.rb
366
+ - lib/mongoid/matcher/bits.rb
367
+ - lib/mongoid/matcher/bits_all_clear.rb
368
+ - lib/mongoid/matcher/bits_all_set.rb
369
+ - lib/mongoid/matcher/bits_any_clear.rb
370
+ - lib/mongoid/matcher/bits_any_set.rb
365
371
  - lib/mongoid/matcher/elem_match.rb
366
372
  - lib/mongoid/matcher/elem_match_expression.rb
367
373
  - lib/mongoid/matcher/eq.rb
@@ -377,6 +383,7 @@ files:
377
383
  - lib/mongoid/matcher/in.rb
378
384
  - lib/mongoid/matcher/lt.rb
379
385
  - lib/mongoid/matcher/lte.rb
386
+ - lib/mongoid/matcher/mod.rb
380
387
  - lib/mongoid/matcher/ne.rb
381
388
  - lib/mongoid/matcher/nin.rb
382
389
  - lib/mongoid/matcher/nor.rb
@@ -384,6 +391,7 @@ files:
384
391
  - lib/mongoid/matcher/or.rb
385
392
  - lib/mongoid/matcher/regex.rb
386
393
  - lib/mongoid/matcher/size.rb
394
+ - lib/mongoid/matcher/type.rb
387
395
  - lib/mongoid/persistable.rb
388
396
  - lib/mongoid/persistable/creatable.rb
389
397
  - lib/mongoid/persistable/deletable.rb
@@ -472,6 +480,11 @@ files:
472
480
  - spec/integration/matcher_examples_spec.rb
473
481
  - spec/integration/matcher_operator_data/all.yml
474
482
  - spec/integration/matcher_operator_data/and.yml
483
+ - spec/integration/matcher_operator_data/bits_all_clear.yml
484
+ - spec/integration/matcher_operator_data/bits_all_set.yml
485
+ - spec/integration/matcher_operator_data/bits_any_clear.yml
486
+ - spec/integration/matcher_operator_data/bits_any_set.yml
487
+ - spec/integration/matcher_operator_data/comment.yml
475
488
  - spec/integration/matcher_operator_data/elem_match.yml
476
489
  - spec/integration/matcher_operator_data/elem_match_expr.yml
477
490
  - spec/integration/matcher_operator_data/eq.yml
@@ -490,6 +503,7 @@ files:
490
503
  - spec/integration/matcher_operator_data/lt_types.yml
491
504
  - spec/integration/matcher_operator_data/lte.yml
492
505
  - spec/integration/matcher_operator_data/lte_types.yml
506
+ - spec/integration/matcher_operator_data/mod.yml
493
507
  - spec/integration/matcher_operator_data/multiple.yml
494
508
  - spec/integration/matcher_operator_data/ne.yml
495
509
  - spec/integration/matcher_operator_data/ne_types.yml
@@ -500,6 +514,28 @@ files:
500
514
  - spec/integration/matcher_operator_data/regex.yml
501
515
  - spec/integration/matcher_operator_data/regex_options.yml
502
516
  - spec/integration/matcher_operator_data/size.yml
517
+ - spec/integration/matcher_operator_data/type.yml
518
+ - spec/integration/matcher_operator_data/type_array.yml
519
+ - spec/integration/matcher_operator_data/type_binary.yml
520
+ - spec/integration/matcher_operator_data/type_boolean.yml
521
+ - spec/integration/matcher_operator_data/type_code.yml
522
+ - spec/integration/matcher_operator_data/type_code_with_scope.yml
523
+ - spec/integration/matcher_operator_data/type_date.yml
524
+ - spec/integration/matcher_operator_data/type_db_pointer.yml
525
+ - spec/integration/matcher_operator_data/type_decimal.yml
526
+ - spec/integration/matcher_operator_data/type_double.yml
527
+ - spec/integration/matcher_operator_data/type_int32.yml
528
+ - spec/integration/matcher_operator_data/type_int64.yml
529
+ - spec/integration/matcher_operator_data/type_max_key.yml
530
+ - spec/integration/matcher_operator_data/type_min_key.yml
531
+ - spec/integration/matcher_operator_data/type_null.yml
532
+ - spec/integration/matcher_operator_data/type_object.yml
533
+ - spec/integration/matcher_operator_data/type_object_id.yml
534
+ - spec/integration/matcher_operator_data/type_regex.yml
535
+ - spec/integration/matcher_operator_data/type_string.yml
536
+ - spec/integration/matcher_operator_data/type_symbol.yml
537
+ - spec/integration/matcher_operator_data/type_timestamp.yml
538
+ - spec/integration/matcher_operator_data/type_undefined.yml
503
539
  - spec/integration/matcher_operator_spec.rb
504
540
  - spec/integration/matcher_spec.rb
505
541
  - spec/integration/server_query_spec.rb
@@ -578,6 +614,9 @@ files:
578
614
  - spec/mongoid/atomic_spec.rb
579
615
  - spec/mongoid/attributes/dynamic_spec.rb
580
616
  - spec/mongoid/attributes/nested_spec.rb
617
+ - spec/mongoid/attributes/projector_data/embedded.yml
618
+ - spec/mongoid/attributes/projector_data/fields.yml
619
+ - spec/mongoid/attributes/projector_spec.rb
581
620
  - spec/mongoid/attributes/readonly_spec.rb
582
621
  - spec/mongoid/attributes_spec.rb
583
622
  - spec/mongoid/cacheable_spec.rb
@@ -636,11 +675,14 @@ files:
636
675
  - spec/mongoid/criteria/queryable/pipeline_spec.rb
637
676
  - spec/mongoid/criteria/queryable/queryable_spec.rb
638
677
  - spec/mongoid/criteria/queryable/selectable_logical_spec.rb
678
+ - spec/mongoid/criteria/queryable/selectable_shared_examples.rb
639
679
  - spec/mongoid/criteria/queryable/selectable_spec.rb
680
+ - spec/mongoid/criteria/queryable/selectable_where_spec.rb
640
681
  - spec/mongoid/criteria/queryable/selector_spec.rb
641
682
  - spec/mongoid/criteria/queryable/smash_spec.rb
642
683
  - spec/mongoid/criteria/queryable/storable_spec.rb
643
684
  - spec/mongoid/criteria/scopable_spec.rb
685
+ - spec/mongoid/criteria_projection_spec.rb
644
686
  - spec/mongoid/criteria_spec.rb
645
687
  - spec/mongoid/document_fields_spec.rb
646
688
  - spec/mongoid/document_persistence_context_spec.rb
@@ -767,6 +809,7 @@ files:
767
809
  - spec/mongoid/timestamps/updated_spec.rb
768
810
  - spec/mongoid/timestamps_spec.rb
769
811
  - spec/mongoid/touchable_spec.rb
812
+ - spec/mongoid/touchable_spec_models.rb
770
813
  - spec/mongoid/traversable_spec.rb
771
814
  - spec/mongoid/validatable/associated_spec.rb
772
815
  - spec/mongoid/validatable/format_spec.rb
@@ -799,7 +842,7 @@ files:
799
842
  - spec/shared/shlib/set_env.sh
800
843
  - spec/spec_helper.rb
801
844
  - spec/support/authorization.rb
802
- - spec/support/cluster_config.rb
845
+ - spec/support/client_registry.rb
803
846
  - spec/support/constraints.rb
804
847
  - spec/support/expectations.rb
805
848
  - spec/support/helpers.rb
@@ -833,6 +876,7 @@ files:
833
876
  - spec/support/models/bed.rb
834
877
  - spec/support/models/big_palette.rb
835
878
  - spec/support/models/birthday.rb
879
+ - spec/support/models/bolt.rb
836
880
  - spec/support/models/bomb.rb
837
881
  - spec/support/models/book.rb
838
882
  - spec/support/models/breed.rb
@@ -904,6 +948,7 @@ files:
904
948
  - spec/support/models/game.rb
905
949
  - spec/support/models/ghost.rb
906
950
  - spec/support/models/guitar.rb
951
+ - spec/support/models/hole.rb
907
952
  - spec/support/models/home.rb
908
953
  - spec/support/models/house.rb
909
954
  - spec/support/models/html_writer.rb
@@ -937,6 +982,7 @@ files:
937
982
  - spec/support/models/name_only.rb
938
983
  - spec/support/models/node.rb
939
984
  - spec/support/models/note.rb
985
+ - spec/support/models/nut.rb
940
986
  - spec/support/models/odd.rb
941
987
  - spec/support/models/order.rb
942
988
  - spec/support/models/ordered_post.rb
@@ -986,6 +1032,7 @@ files:
986
1032
  - spec/support/models/sandwich.rb
987
1033
  - spec/support/models/scheduler.rb
988
1034
  - spec/support/models/scribe.rb
1035
+ - spec/support/models/sealer.rb
989
1036
  - spec/support/models/seat.rb
990
1037
  - spec/support/models/seo.rb
991
1038
  - spec/support/models/series.rb
@@ -996,6 +1043,7 @@ files:
996
1043
  - spec/support/models/shipment_address.rb
997
1044
  - spec/support/models/shipping_container.rb
998
1045
  - spec/support/models/shipping_pack.rb
1046
+ - spec/support/models/shirt.rb
999
1047
  - spec/support/models/shop.rb
1000
1048
  - spec/support/models/short_agent.rb
1001
1049
  - spec/support/models/short_quiz.rb
@@ -1003,6 +1051,7 @@ files:
1003
1051
  - spec/support/models/slave.rb
1004
1052
  - spec/support/models/song.rb
1005
1053
  - spec/support/models/sound.rb
1054
+ - spec/support/models/spacer.rb
1006
1055
  - spec/support/models/square.rb
1007
1056
  - spec/support/models/staff.rb
1008
1057
  - spec/support/models/store_as_dup_test1.rb
@@ -1019,6 +1068,7 @@ files:
1019
1068
  - spec/support/models/target.rb
1020
1069
  - spec/support/models/template.rb
1021
1070
  - spec/support/models/thing.rb
1071
+ - spec/support/models/threadlocker.rb
1022
1072
  - spec/support/models/title.rb
1023
1073
  - spec/support/models/tool.rb
1024
1074
  - spec/support/models/topping.rb
@@ -1037,6 +1087,7 @@ files:
1037
1087
  - spec/support/models/vet_visit.rb
1038
1088
  - spec/support/models/video.rb
1039
1089
  - spec/support/models/video_game.rb
1090
+ - spec/support/models/washer.rb
1040
1091
  - spec/support/models/weapon.rb
1041
1092
  - spec/support/models/wiki_page.rb
1042
1093
  - spec/support/models/word.rb
@@ -1105,6 +1156,11 @@ test_files:
1105
1156
  - spec/integration/matcher_examples_spec.rb
1106
1157
  - spec/integration/matcher_operator_data/all.yml
1107
1158
  - spec/integration/matcher_operator_data/and.yml
1159
+ - spec/integration/matcher_operator_data/bits_all_clear.yml
1160
+ - spec/integration/matcher_operator_data/bits_all_set.yml
1161
+ - spec/integration/matcher_operator_data/bits_any_clear.yml
1162
+ - spec/integration/matcher_operator_data/bits_any_set.yml
1163
+ - spec/integration/matcher_operator_data/comment.yml
1108
1164
  - spec/integration/matcher_operator_data/elem_match.yml
1109
1165
  - spec/integration/matcher_operator_data/elem_match_expr.yml
1110
1166
  - spec/integration/matcher_operator_data/eq.yml
@@ -1123,6 +1179,7 @@ test_files:
1123
1179
  - spec/integration/matcher_operator_data/lt_types.yml
1124
1180
  - spec/integration/matcher_operator_data/lte.yml
1125
1181
  - spec/integration/matcher_operator_data/lte_types.yml
1182
+ - spec/integration/matcher_operator_data/mod.yml
1126
1183
  - spec/integration/matcher_operator_data/multiple.yml
1127
1184
  - spec/integration/matcher_operator_data/ne.yml
1128
1185
  - spec/integration/matcher_operator_data/ne_types.yml
@@ -1133,6 +1190,28 @@ test_files:
1133
1190
  - spec/integration/matcher_operator_data/regex.yml
1134
1191
  - spec/integration/matcher_operator_data/regex_options.yml
1135
1192
  - spec/integration/matcher_operator_data/size.yml
1193
+ - spec/integration/matcher_operator_data/type.yml
1194
+ - spec/integration/matcher_operator_data/type_array.yml
1195
+ - spec/integration/matcher_operator_data/type_binary.yml
1196
+ - spec/integration/matcher_operator_data/type_boolean.yml
1197
+ - spec/integration/matcher_operator_data/type_code.yml
1198
+ - spec/integration/matcher_operator_data/type_code_with_scope.yml
1199
+ - spec/integration/matcher_operator_data/type_date.yml
1200
+ - spec/integration/matcher_operator_data/type_db_pointer.yml
1201
+ - spec/integration/matcher_operator_data/type_decimal.yml
1202
+ - spec/integration/matcher_operator_data/type_double.yml
1203
+ - spec/integration/matcher_operator_data/type_int32.yml
1204
+ - spec/integration/matcher_operator_data/type_int64.yml
1205
+ - spec/integration/matcher_operator_data/type_max_key.yml
1206
+ - spec/integration/matcher_operator_data/type_min_key.yml
1207
+ - spec/integration/matcher_operator_data/type_null.yml
1208
+ - spec/integration/matcher_operator_data/type_object.yml
1209
+ - spec/integration/matcher_operator_data/type_object_id.yml
1210
+ - spec/integration/matcher_operator_data/type_regex.yml
1211
+ - spec/integration/matcher_operator_data/type_string.yml
1212
+ - spec/integration/matcher_operator_data/type_symbol.yml
1213
+ - spec/integration/matcher_operator_data/type_timestamp.yml
1214
+ - spec/integration/matcher_operator_data/type_undefined.yml
1136
1215
  - spec/integration/matcher_operator_spec.rb
1137
1216
  - spec/integration/matcher_spec.rb
1138
1217
  - spec/integration/server_query_spec.rb
@@ -1211,6 +1290,9 @@ test_files:
1211
1290
  - spec/mongoid/atomic_spec.rb
1212
1291
  - spec/mongoid/attributes/dynamic_spec.rb
1213
1292
  - spec/mongoid/attributes/nested_spec.rb
1293
+ - spec/mongoid/attributes/projector_data/embedded.yml
1294
+ - spec/mongoid/attributes/projector_data/fields.yml
1295
+ - spec/mongoid/attributes/projector_spec.rb
1214
1296
  - spec/mongoid/attributes/readonly_spec.rb
1215
1297
  - spec/mongoid/attributes_spec.rb
1216
1298
  - spec/mongoid/cacheable_spec.rb
@@ -1269,11 +1351,14 @@ test_files:
1269
1351
  - spec/mongoid/criteria/queryable/pipeline_spec.rb
1270
1352
  - spec/mongoid/criteria/queryable/queryable_spec.rb
1271
1353
  - spec/mongoid/criteria/queryable/selectable_logical_spec.rb
1354
+ - spec/mongoid/criteria/queryable/selectable_shared_examples.rb
1272
1355
  - spec/mongoid/criteria/queryable/selectable_spec.rb
1356
+ - spec/mongoid/criteria/queryable/selectable_where_spec.rb
1273
1357
  - spec/mongoid/criteria/queryable/selector_spec.rb
1274
1358
  - spec/mongoid/criteria/queryable/smash_spec.rb
1275
1359
  - spec/mongoid/criteria/queryable/storable_spec.rb
1276
1360
  - spec/mongoid/criteria/scopable_spec.rb
1361
+ - spec/mongoid/criteria_projection_spec.rb
1277
1362
  - spec/mongoid/criteria_spec.rb
1278
1363
  - spec/mongoid/document_fields_spec.rb
1279
1364
  - spec/mongoid/document_persistence_context_spec.rb
@@ -1400,6 +1485,7 @@ test_files:
1400
1485
  - spec/mongoid/timestamps/updated_spec.rb
1401
1486
  - spec/mongoid/timestamps_spec.rb
1402
1487
  - spec/mongoid/touchable_spec.rb
1488
+ - spec/mongoid/touchable_spec_models.rb
1403
1489
  - spec/mongoid/traversable_spec.rb
1404
1490
  - spec/mongoid/validatable/associated_spec.rb
1405
1491
  - spec/mongoid/validatable/format_spec.rb
@@ -1432,7 +1518,7 @@ test_files:
1432
1518
  - spec/shared/shlib/set_env.sh
1433
1519
  - spec/spec_helper.rb
1434
1520
  - spec/support/authorization.rb
1435
- - spec/support/cluster_config.rb
1521
+ - spec/support/client_registry.rb
1436
1522
  - spec/support/constraints.rb
1437
1523
  - spec/support/expectations.rb
1438
1524
  - spec/support/helpers.rb
@@ -1466,6 +1552,7 @@ test_files:
1466
1552
  - spec/support/models/bed.rb
1467
1553
  - spec/support/models/big_palette.rb
1468
1554
  - spec/support/models/birthday.rb
1555
+ - spec/support/models/bolt.rb
1469
1556
  - spec/support/models/bomb.rb
1470
1557
  - spec/support/models/book.rb
1471
1558
  - spec/support/models/breed.rb
@@ -1537,6 +1624,7 @@ test_files:
1537
1624
  - spec/support/models/game.rb
1538
1625
  - spec/support/models/ghost.rb
1539
1626
  - spec/support/models/guitar.rb
1627
+ - spec/support/models/hole.rb
1540
1628
  - spec/support/models/home.rb
1541
1629
  - spec/support/models/house.rb
1542
1630
  - spec/support/models/html_writer.rb
@@ -1570,6 +1658,7 @@ test_files:
1570
1658
  - spec/support/models/name_only.rb
1571
1659
  - spec/support/models/node.rb
1572
1660
  - spec/support/models/note.rb
1661
+ - spec/support/models/nut.rb
1573
1662
  - spec/support/models/odd.rb
1574
1663
  - spec/support/models/order.rb
1575
1664
  - spec/support/models/ordered_post.rb
@@ -1619,6 +1708,7 @@ test_files:
1619
1708
  - spec/support/models/sandwich.rb
1620
1709
  - spec/support/models/scheduler.rb
1621
1710
  - spec/support/models/scribe.rb
1711
+ - spec/support/models/sealer.rb
1622
1712
  - spec/support/models/seat.rb
1623
1713
  - spec/support/models/seo.rb
1624
1714
  - spec/support/models/series.rb
@@ -1629,6 +1719,7 @@ test_files:
1629
1719
  - spec/support/models/shipment_address.rb
1630
1720
  - spec/support/models/shipping_container.rb
1631
1721
  - spec/support/models/shipping_pack.rb
1722
+ - spec/support/models/shirt.rb
1632
1723
  - spec/support/models/shop.rb
1633
1724
  - spec/support/models/short_agent.rb
1634
1725
  - spec/support/models/short_quiz.rb
@@ -1636,6 +1727,7 @@ test_files:
1636
1727
  - spec/support/models/slave.rb
1637
1728
  - spec/support/models/song.rb
1638
1729
  - spec/support/models/sound.rb
1730
+ - spec/support/models/spacer.rb
1639
1731
  - spec/support/models/square.rb
1640
1732
  - spec/support/models/staff.rb
1641
1733
  - spec/support/models/store_as_dup_test1.rb
@@ -1652,6 +1744,7 @@ test_files:
1652
1744
  - spec/support/models/target.rb
1653
1745
  - spec/support/models/template.rb
1654
1746
  - spec/support/models/thing.rb
1747
+ - spec/support/models/threadlocker.rb
1655
1748
  - spec/support/models/title.rb
1656
1749
  - spec/support/models/tool.rb
1657
1750
  - spec/support/models/topping.rb
@@ -1670,6 +1763,7 @@ test_files:
1670
1763
  - spec/support/models/vet_visit.rb
1671
1764
  - spec/support/models/video.rb
1672
1765
  - spec/support/models/video_game.rb
1766
+ - spec/support/models/washer.rb
1673
1767
  - spec/support/models/weapon.rb
1674
1768
  - spec/support/models/wiki_page.rb
1675
1769
  - spec/support/models/word.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,158 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- require 'singleton'
5
-
6
- class ClusterConfig
7
- include Singleton
8
-
9
- def single_server?
10
- determine_cluster_config
11
- @single_server
12
- end
13
-
14
- def replica_set_name
15
- determine_cluster_config
16
- @replica_set_name
17
- end
18
-
19
- def server_version
20
- determine_cluster_config
21
- @server_version
22
- end
23
-
24
- def short_server_version
25
- server_version.split('.')[0..1].join('.')
26
- end
27
-
28
- def fcv
29
- determine_cluster_config
30
- @fcv
31
- end
32
-
33
- # Per https://jira.mongodb.org/browse/SERVER-39052, working with FCV
34
- # in sharded topologies is annoying. Also, FCV doesn't exist in servers
35
- # less than 3.4. This method returns FCV on 3.4+ servers when in single
36
- # or RS topologies, and otherwise returns the major.minor server version.
37
- def fcv_ish
38
- if server_version >= '3.4' && topology != :sharded
39
- fcv
40
- else
41
- if short_server_version == '4.1'
42
- '4.2'
43
- else
44
- short_server_version
45
- end
46
- end
47
- end
48
-
49
- def primary_address
50
- determine_cluster_config
51
- @primary_address
52
- end
53
-
54
- def primary_address_str
55
- determine_cluster_config
56
- @primary_address.seed
57
- end
58
-
59
- def primary_address_host
60
- both = primary_address_str
61
- both.split(':').first
62
- end
63
-
64
- def primary_address_port
65
- both = primary_address_str
66
- both.split(':')[1] || 27017
67
- end
68
-
69
- def primary_description
70
- determine_cluster_config
71
- @primary_description
72
- end
73
-
74
- # Try running a command on the admin database to see if the mongod was
75
- # started with auth.
76
- def auth_enabled?
77
- if @auth_enabled.nil?
78
- @auth_enabled = begin
79
- basic_client.use(:admin).command(getCmdLineOpts: 1).first["argv"].include?("--auth")
80
- rescue => e
81
- e.message =~ /(not authorized)|(unauthorized)|(no users authenticated)|(requires authentication)/
82
- end
83
- end
84
- @auth_enabled
85
- end
86
-
87
- def topology
88
- determine_cluster_config
89
- @topology
90
- end
91
-
92
- def storage_engine
93
- @storage_engine ||= begin
94
- # 2.6 does not have wired tiger
95
- if short_server_version == '2.6'
96
- :mmapv1
97
- else
98
- client = ClientRegistry.instance.global_client('root_authorized')
99
- if topology == :sharded
100
- shards = client.use(:admin).command(listShards: 1).first
101
- shard = shards['shards'].first
102
- address_str = shard['host'].sub(/\A.*\//, '').sub(/,.*/, '')
103
- client = ClusterTools.instance.direct_client(address_str,
104
- SpecConfig.instance.test_options.merge(SpecConfig.instance.auth_options).merge(connect: :direct))
105
- end
106
- rv = client.use(:admin).command(serverStatus: 1).first
107
- rv = rv['storageEngine']['name']
108
- rv_map = {
109
- 'wiredTiger' => :wired_tiger,
110
- 'mmapv1' => :mmapv1,
111
- }
112
- rv_map[rv] || rv
113
- end
114
- end
115
- end
116
-
117
- private
118
-
119
- def determine_cluster_config
120
- return if @primary_address
121
-
122
- # Run all commands to figure out the cluster configuration from the same
123
- # client. This is somewhat wasteful when running a single test, but reduces
124
- # test runtime for the suite overall because all commands are sent on the
125
- # same connection rather than each command connecting to the cluster by
126
- # itself.
127
- client = Mongoid::Clients.default
128
-
129
- primary = client.cluster.next_primary
130
- @primary_address = primary.address
131
- @primary_description = primary.description
132
- @replica_set_name = client.cluster.topology.replica_set_name
133
-
134
- @topology ||= begin
135
- topology = client.cluster.topology.class.name.sub(/.*::/, '')
136
- topology = topology.gsub(/([A-Z])/) { |match| '_' + match.downcase }.sub(/\A_/, '')
137
- if topology =~ /\Areplica_set/
138
- topology = 'replica_set'
139
- end
140
- topology.to_sym
141
- end
142
-
143
- @single_server = client.cluster.send(:servers_list).length == 1
144
-
145
- @server_version = client.database.command(buildInfo: 1).first['version']
146
-
147
- if @topology != :sharded && short_server_version >= '3.4'
148
- rv = client.use(:admin).command(getParameter: 1, featureCompatibilityVersion: 1).first['featureCompatibilityVersion']
149
- @fcv = rv['version'] || rv
150
- end
151
- end
152
-
153
- def basic_client
154
- # Do not cache the result here so that if the client gets closed,
155
- # client registry reconnects it in subsequent tests
156
- ClientRegistry.instance.global_client('basic')
157
- end
158
- end