mongoid 7.4.0 → 7.4.1

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.md +2 -2
  4. data/lib/mongoid/association/embedded/batchable.rb +20 -3
  5. data/lib/mongoid/association/referenced/has_many/proxy.rb +2 -2
  6. data/lib/mongoid/atomic/paths/embedded/many.rb +19 -0
  7. data/lib/mongoid/config/environment.rb +20 -4
  8. data/lib/mongoid/persistable/upsertable.rb +1 -1
  9. data/lib/mongoid/traversable.rb +4 -1
  10. data/lib/mongoid/version.rb +1 -1
  11. data/lib/rails/generators/mongoid/config/templates/mongoid.yml +7 -2
  12. data/spec/config/mongoid_with_schema_map_uuid.yml +27 -0
  13. data/spec/integration/app_spec.rb +20 -14
  14. data/spec/integration/associations/embedded_dirty_spec.rb +28 -0
  15. data/spec/lite_spec_helper.rb +1 -1
  16. data/spec/mongoid/association/embedded/embeds_many/proxy_spec.rb +21 -0
  17. data/spec/mongoid/association/embedded/embeds_many_models.rb +121 -0
  18. data/spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_spec.rb +8 -0
  19. data/spec/mongoid/association/referenced/has_many/proxy_spec.rb +24 -8
  20. data/spec/mongoid/atomic_spec.rb +22 -0
  21. data/spec/mongoid/clients/factory_spec.rb +11 -12
  22. data/spec/mongoid/config/environment_spec.rb +39 -1
  23. data/spec/mongoid/config_spec.rb +40 -0
  24. data/spec/mongoid/errors/mongoid_error_spec.rb +1 -1
  25. data/spec/shared/lib/mrss/constraints.rb +8 -16
  26. data/spec/shared/lib/mrss/docker_runner.rb +23 -3
  27. data/spec/shared/lib/mrss/eg_config_utils.rb +51 -0
  28. data/spec/shared/lib/mrss/event_subscriber.rb +15 -5
  29. data/spec/shared/lib/mrss/lite_constraints.rb +32 -1
  30. data/spec/shared/share/Dockerfile.erb +34 -48
  31. data/spec/shared/shlib/config.sh +27 -0
  32. data/spec/shared/shlib/server.sh +32 -19
  33. data/spec/shared/shlib/set_env.sh +37 -0
  34. data/spec/support/macros.rb +9 -0
  35. data/spec/support/models/membership.rb +1 -0
  36. data/spec/support/schema_maps/schema_map_aws.json +17 -0
  37. data/spec/support/schema_maps/schema_map_aws_key_alt_names.json +12 -0
  38. data/spec/support/schema_maps/schema_map_azure.json +17 -0
  39. data/spec/support/schema_maps/schema_map_azure_key_alt_names.json +12 -0
  40. data/spec/support/schema_maps/schema_map_gcp.json +17 -0
  41. data/spec/support/schema_maps/schema_map_gcp_key_alt_names.json +12 -0
  42. data/spec/support/schema_maps/schema_map_kmip.json +17 -0
  43. data/spec/support/schema_maps/schema_map_kmip_key_alt_names.json +12 -0
  44. data/spec/support/schema_maps/schema_map_local.json +18 -0
  45. data/spec/support/schema_maps/schema_map_local_key_alt_names.json +12 -0
  46. data/spec/support/spec_config.rb +4 -0
  47. data.tar.gz.sig +0 -0
  48. metadata +28 -2
  49. metadata.gz.sig +0 -0
@@ -46,44 +46,54 @@ prepare_server() {
46
46
  if test "$MONGODB_VERSION" = latest; then
47
47
  # Test on the most recent published 4.3 release.
48
48
  # https://jira.mongodb.org/browse/RUBY-1724
49
- echo 'Using "latest" server is not currently implemented' 1>&2
50
- exit 1
49
+
50
+ . $PROJECT_DIRECTORY/.mod/drivers-evergreen-tools/.evergreen/download-mongodb.sh
51
+
52
+ get_distro
53
+ get_mongodb_download_url_for "$DISTRO" "latest"
54
+ prepare_server_from_url $MONGODB_DOWNLOAD_URL
51
55
  else
52
56
  download_version="$MONGODB_VERSION"
57
+ url=`$(dirname $0)/get-mongodb-download-url $download_version $arch`
58
+ prepare_server_from_url $url
53
59
  fi
54
60
 
55
- url=`$(dirname $0)/get-mongodb-download-url $download_version $arch`
56
-
57
- prepare_server_from_url $url
58
61
  }
59
62
 
60
63
  prepare_server_from_url() {
61
64
  url=$1
62
65
 
63
- mongodb_dir="$MONGO_ORCHESTRATION_HOME"/mdb
66
+ dirname=`basename $url |sed -e s/.tgz//`
67
+ mongodb_dir="$MONGO_ORCHESTRATION_HOME"/mdb/"$dirname"
64
68
  mkdir -p "$mongodb_dir"
65
- curl --retry 3 $url |tar xz -C "$mongodb_dir" -f -
66
- BINDIR="$mongodb_dir"/`basename $url |sed -e s/.tgz//`/bin
69
+ curl --retry 3 $url | tar xz -C "$mongodb_dir" --strip-components 1 -f -
70
+ BINDIR="$mongodb_dir"/bin
67
71
  export PATH="$BINDIR":$PATH
68
72
  }
69
73
 
70
74
  install_mlaunch_virtualenv() {
71
- python2 -V || true
72
- if ! python2 -m virtualenv -h >/dev/null; then
75
+ python3 -V || true
76
+ if ! python3 -m virtualenv -h >/dev/null; then
73
77
  # Current virtualenv fails with
74
78
  # https://github.com/pypa/virtualenv/issues/1630
75
- python2 -m pip install 'virtualenv<20' --user
79
+ python3 -m pip install 'virtualenv<20' --user
76
80
  fi
77
81
  if test "$USE_SYSTEM_PYTHON_PACKAGES" = 1 &&
78
- python2 -m pip list |grep mtools-legacy
82
+ python3 -m pip list |grep mtools
79
83
  then
80
84
  # Use the existing mtools-legacy
81
85
  :
82
86
  else
83
87
  venvpath="$MONGO_ORCHESTRATION_HOME"/venv
84
- python2 -m virtualenv -p python2 $venvpath
88
+ python3 -m virtualenv -p python3 $venvpath
85
89
  . $venvpath/bin/activate
86
- pip install 'mtools-legacy[mlaunch]'
90
+ # [mlaunch] does not work:
91
+ # https://github.com/rueckstiess/mtools/issues/856
92
+ # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
93
+ #pip install 'mtools==1.7' 'pymongo==4.1' python-dateutil psutil
94
+
95
+ # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
96
+ pip install 'mtools-legacy[mlaunch]' 'pymongo<4' python-dateutil
87
97
  fi
88
98
  }
89
99
 
@@ -96,7 +106,8 @@ install_mlaunch_pip() {
96
106
  python -V || true
97
107
  python3 -V || true
98
108
  pythonpath="$MONGO_ORCHESTRATION_HOME"/python
99
- pip install -t "$pythonpath" 'mtools-legacy[mlaunch]'
109
+ # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
110
+ pip install -t "$pythonpath" 'mtools-legacy[mlaunch]' 'pymongo<4' python-dateutil
100
111
  export PATH="$pythonpath/bin":$PATH
101
112
  export PYTHONPATH="$pythonpath"
102
113
  }
@@ -120,7 +131,8 @@ install_mlaunch_git() {
120
131
  virtualenv -p python3 $venvpath
121
132
  . $venvpath/bin/activate
122
133
 
123
- pip3 install psutil pymongo
134
+ # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
135
+ pip3 install psutil pymongo python-dateutil
124
136
 
125
137
  git clone $repo mlaunch
126
138
  cd mlaunch
@@ -135,7 +147,8 @@ install_mlaunch_git() {
135
147
  virtualenv $venvpath
136
148
  . $venvpath/bin/activate
137
149
 
138
- pip install psutil pymongo
150
+ # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
151
+ pip install psutil pymongo python-dateutil
139
152
 
140
153
  git clone $repo mlaunch
141
154
  (cd mlaunch &&
@@ -160,7 +173,7 @@ calculate_server_args() {
160
173
  fi
161
174
 
162
175
  if test $mongo_version = latest; then
163
- mongo_version=49
176
+ mongo_version=60
164
177
  fi
165
178
 
166
179
  local args="--setParameter enableTestCommands=1"
@@ -321,7 +334,7 @@ launch_ocsp_mock() {
321
334
 
322
335
  launch_server() {
323
336
  local dbdir="$1"
324
- python2 -m mtools.mlaunch.mlaunch --dir "$dbdir" --binarypath "$BINDIR" $SERVER_ARGS
337
+ python3 -m mtools.mlaunch.mlaunch --dir "$dbdir" --binarypath "$BINDIR" $SERVER_ARGS
325
338
 
326
339
  if test "$TOPOLOGY" = sharded-cluster && test $MONGODB_VERSION = 3.6; then
327
340
  # On 3.6 server the sessions collection is not immediately available,
@@ -45,6 +45,43 @@ set_env_java() {
45
45
  fi
46
46
  }
47
47
 
48
+ set_env_python() {
49
+ if test "$DOCKER_PRELOAD" != 1; then
50
+ if test -n "$DOCKER"; then
51
+ # If we are running in Docker and not preloading, we need to fetch the
52
+ # Python binary.
53
+ curl -fL --retry 3 https://github.com/p-mongodb/deps/raw/main/"$arch"-python37.tar.xz | \
54
+ tar xfJ - -C /opt
55
+ fi
56
+
57
+ if test -d /opt/python/3.7/bin; then
58
+ # Most Evergreen configurations.
59
+ export PATH=/opt/python/3.7/bin:$PATH
60
+ elif test -d /opt/python37/bin; then
61
+ # Configurations that use Docker in Evergreen - these don't preload.
62
+ export PATH=/opt/python37/bin:$PATH
63
+ fi
64
+
65
+ python3 -V
66
+ fi
67
+ }
68
+
69
+ set_env_node() {
70
+ if test "$DOCKER_PRELOAD" != 1; then
71
+ dir=`ls -d /opt/nodejs/node-v12* |head -1`
72
+ if test -z "$dir"; then
73
+ echo "Node 12 missing" 1>&2
74
+ exit 2
75
+ fi
76
+ export PATH="$dir/bin:$PATH"
77
+ elif test -d /opt/node/bin; then
78
+ # Node from toolchain in Evergreen
79
+ export PATH=/opt/node/bin:$PATH
80
+ fi
81
+
82
+ node -v
83
+ }
84
+
48
85
  set_env_ruby() {
49
86
  if test -z "$RVM_RUBY"; then
50
87
  echo "Empty RVM_RUBY, aborting"
@@ -38,5 +38,14 @@ module Mongoid
38
38
  end
39
39
  end
40
40
  end
41
+
42
+ def restore_config_clients
43
+ around do |example|
44
+ # Duplicate the config because some tests mutate it.
45
+ old_config = Mongoid::Config.clients.dup
46
+ example.run
47
+ Mongoid::Config.send(:clients=, old_config)
48
+ end
49
+ end
41
50
  end
42
51
  end
@@ -2,5 +2,6 @@
2
2
 
3
3
  class Membership
4
4
  include Mongoid::Document
5
+ field :name, type: String
5
6
  embedded_in :account
6
7
  end
@@ -0,0 +1,17 @@
1
+ {
2
+ "properties": {
3
+ "ssn": {
4
+ "encrypt": {
5
+ "keyId": [{
6
+ "$binary": {
7
+ "base64": "AWSAAAAAAAAAAAAAAAAAAA==",
8
+ "subType": "04"
9
+ }
10
+ }],
11
+ "bsonType": "string",
12
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
13
+ }
14
+ }
15
+ },
16
+ "bsonType": "object"
17
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "properties": {
3
+ "ssn": {
4
+ "encrypt": {
5
+ "keyId": "/altname",
6
+ "bsonType": "string",
7
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
8
+ }
9
+ }
10
+ },
11
+ "bsonType": "object"
12
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "properties": {
3
+ "ssn": {
4
+ "encrypt": {
5
+ "keyId": [{
6
+ "$binary": {
7
+ "base64": "AZUREAAAAAAAAAAAAAAAAA==",
8
+ "subType": "04"
9
+ }
10
+ }],
11
+ "bsonType": "string",
12
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
13
+ }
14
+ }
15
+ },
16
+ "bsonType": "object"
17
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "properties": {
3
+ "ssn": {
4
+ "encrypt": {
5
+ "keyId": "/altname",
6
+ "bsonType": "string",
7
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
8
+ }
9
+ }
10
+ },
11
+ "bsonType": "object"
12
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "properties": {
3
+ "ssn": {
4
+ "encrypt": {
5
+ "keyId": [{
6
+ "$binary": {
7
+ "base64": "GCPAAAAAAAAAAAAAAAAAAA==",
8
+ "subType": "04"
9
+ }
10
+ }],
11
+ "bsonType": "string",
12
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
13
+ }
14
+ }
15
+ },
16
+ "bsonType": "object"
17
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "properties": {
3
+ "ssn": {
4
+ "encrypt": {
5
+ "keyId": "/altname",
6
+ "bsonType": "string",
7
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
8
+ }
9
+ }
10
+ },
11
+ "bsonType": "object"
12
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "properties": {
3
+ "ssn": {
4
+ "encrypt": {
5
+ "keyId": [{
6
+ "$binary": {
7
+ "base64": "KMIPAAAAAAAAAAAAAAAAAA==",
8
+ "subType": "04"
9
+ }
10
+ }],
11
+ "bsonType": "string",
12
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
13
+ }
14
+ }
15
+ },
16
+ "bsonType": "object"
17
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "properties": {
3
+ "ssn": {
4
+ "encrypt": {
5
+ "keyId": "/altname",
6
+ "bsonType": "string",
7
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
8
+ }
9
+ }
10
+ },
11
+ "bsonType": "object"
12
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "properties": {
3
+ "ssn": {
4
+ "encrypt": {
5
+ "keyId": [{
6
+ "$binary": {
7
+ "base64": "LOCALAAAAAAAAAAAAAAAAA==",
8
+ "subType": "04"
9
+
10
+ }
11
+ }],
12
+ "bsonType": "string",
13
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
14
+ }
15
+ }
16
+ },
17
+ "bsonType": "object"
18
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "properties": {
3
+ "ssn": {
4
+ "encrypt": {
5
+ "keyId": "/altname",
6
+ "bsonType": "string",
7
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
8
+ }
9
+ }
10
+ },
11
+ "bsonType": "object"
12
+ }
@@ -34,6 +34,10 @@ class SpecConfig
34
34
  RUBY_PLATFORM =~ /\bjava\b/
35
35
  end
36
36
 
37
+ def windows?
38
+ ENV['OS'] == 'Windows_NT' && !RUBY_PLATFORM.match?(/cygwin/)
39
+ end
40
+
37
41
  def platform
38
42
  RUBY_PLATFORM
39
43
  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.4.0
4
+ version: 7.4.1
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-03-30 00:00:00.000000000 Z
33
+ date: 2022-07-20 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: activemodel
@@ -460,6 +460,7 @@ files:
460
460
  - lib/rails/mongoid.rb
461
461
  - spec/README.md
462
462
  - spec/config/mongoid.yml
463
+ - spec/config/mongoid_with_schema_map_uuid.yml
463
464
  - spec/integration/app_spec.rb
464
465
  - spec/integration/associations/belongs_to_spec.rb
465
466
  - spec/integration/associations/embedded_dirty_spec.rb
@@ -842,6 +843,7 @@ files:
842
843
  - spec/shared/lib/mrss/cluster_config.rb
843
844
  - spec/shared/lib/mrss/constraints.rb
844
845
  - spec/shared/lib/mrss/docker_runner.rb
846
+ - spec/shared/lib/mrss/eg_config_utils.rb
845
847
  - spec/shared/lib/mrss/event_subscriber.rb
846
848
  - spec/shared/lib/mrss/lite_constraints.rb
847
849
  - spec/shared/lib/mrss/server_version_registry.rb
@@ -852,6 +854,7 @@ files:
852
854
  - spec/shared/share/Dockerfile.erb
853
855
  - spec/shared/share/haproxy-1.conf
854
856
  - spec/shared/share/haproxy-2.conf
857
+ - spec/shared/shlib/config.sh
855
858
  - spec/shared/shlib/distro.sh
856
859
  - spec/shared/shlib/server.sh
857
860
  - spec/shared/shlib/set_env.sh
@@ -1110,6 +1113,16 @@ files:
1110
1113
  - spec/support/models/word.rb
1111
1114
  - spec/support/models/word_origin.rb
1112
1115
  - spec/support/models/writer.rb
1116
+ - spec/support/schema_maps/schema_map_aws.json
1117
+ - spec/support/schema_maps/schema_map_aws_key_alt_names.json
1118
+ - spec/support/schema_maps/schema_map_azure.json
1119
+ - spec/support/schema_maps/schema_map_azure_key_alt_names.json
1120
+ - spec/support/schema_maps/schema_map_gcp.json
1121
+ - spec/support/schema_maps/schema_map_gcp_key_alt_names.json
1122
+ - spec/support/schema_maps/schema_map_kmip.json
1123
+ - spec/support/schema_maps/schema_map_kmip_key_alt_names.json
1124
+ - spec/support/schema_maps/schema_map_local.json
1125
+ - spec/support/schema_maps/schema_map_local_key_alt_names.json
1113
1126
  - spec/support/shared/time.rb
1114
1127
  - spec/support/spec_config.rb
1115
1128
  homepage: https://mongoid.org
@@ -1240,6 +1253,7 @@ test_files:
1240
1253
  - spec/integration/matcher_operator_spec.rb
1241
1254
  - spec/integration/app_spec.rb
1242
1255
  - spec/integration/matcher_examples_spec.rb
1256
+ - spec/config/mongoid_with_schema_map_uuid.yml
1243
1257
  - spec/config/mongoid.yml
1244
1258
  - spec/support/constraints.rb
1245
1259
  - spec/support/models/tree.rb
@@ -1493,6 +1507,16 @@ test_files:
1493
1507
  - spec/support/macros.rb
1494
1508
  - spec/support/spec_config.rb
1495
1509
  - spec/support/helpers.rb
1510
+ - spec/support/schema_maps/schema_map_local_key_alt_names.json
1511
+ - spec/support/schema_maps/schema_map_aws_key_alt_names.json
1512
+ - spec/support/schema_maps/schema_map_kmip.json
1513
+ - spec/support/schema_maps/schema_map_azure.json
1514
+ - spec/support/schema_maps/schema_map_kmip_key_alt_names.json
1515
+ - spec/support/schema_maps/schema_map_local.json
1516
+ - spec/support/schema_maps/schema_map_gcp_key_alt_names.json
1517
+ - spec/support/schema_maps/schema_map_aws.json
1518
+ - spec/support/schema_maps/schema_map_gcp.json
1519
+ - spec/support/schema_maps/schema_map_azure_key_alt_names.json
1496
1520
  - spec/support/client_registry.rb
1497
1521
  - spec/support/expectations.rb
1498
1522
  - spec/support/authorization.rb
@@ -1506,11 +1530,13 @@ test_files:
1506
1530
  - spec/shared/bin/s3-upload
1507
1531
  - spec/shared/shlib/distro.sh
1508
1532
  - spec/shared/shlib/set_env.sh
1533
+ - spec/shared/shlib/config.sh
1509
1534
  - spec/shared/shlib/server.sh
1510
1535
  - spec/shared/LICENSE
1511
1536
  - spec/shared/lib/mrss/constraints.rb
1512
1537
  - spec/shared/lib/mrss/cluster_config.rb
1513
1538
  - spec/shared/lib/mrss/child_process_helper.rb
1539
+ - spec/shared/lib/mrss/eg_config_utils.rb
1514
1540
  - spec/shared/lib/mrss/event_subscriber.rb
1515
1541
  - spec/shared/lib/mrss/utils.rb
1516
1542
  - spec/shared/lib/mrss/server_version_registry.rb
metadata.gz.sig CHANGED
Binary file