mongoid_monkey 0.2.2 → 0.2.3
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
- data/README.md +1 -0
- data/lib/mongoid_monkey.rb +1 -0
- data/lib/patches/index_options.rb +58 -0
- data/lib/version.rb +1 -1
- data/spec/unit/index_options_spec.rb +31 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3134be59a7b9be08b329ac420d3189cae51b91a8
|
4
|
+
data.tar.gz: 35ae853f92db846150ec9ad1e839e8b838835d8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c87ede75b4c5dd2aacdf2686115c2941e4ba04ffb9833345a2dd67d3463206eacfb69a3e57c00dc2ba119d8c9f6fb406c027936e630586bdf6850a2f34b8e04
|
7
|
+
data.tar.gz: 09fd17ff52016d85d673683792c80b3b97ab5f3d06ff11f9f39a9ffa8c44b319576cb8303ec14252a994131e2214cb30fc61288257d5cedb75ed416cd9ba829b
|
data/README.md
CHANGED
@@ -38,6 +38,7 @@ If you would only like some of the patches, please copy and paste the code to yo
|
|
38
38
|
| `reorder.rb` | Backport `Criteria#reorder` method from Mongoid 4. | ● | ○ | ○ |
|
39
39
|
| `only_pluck_localized.rb` | Backport [PR #4299](https://github.com/mongodb/mongoid/pull/4299) from Mongoid 6 which fixes `#only`, `#without`, and `#pluck` with localized fields. | ● | × | × |
|
40
40
|
| `embedded_touch.rb` | Backport [Issue #3310](https://github.com/mongodb/mongoid/commit/a94c2f43573e58f973913c881ad9d11d62bf857c) from Mongoid 4 to add `:touch` option to `embedded_in`. | ● | ○ | ○ |
|
41
|
+
| `index_options.rb` | Backport latest index valid index options from Mongoid 6. | ● | ● | ○ |
|
41
42
|
|
42
43
|
### License
|
43
44
|
|
data/lib/mongoid_monkey.rb
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Backport Mongoid 6 index options to Mongoid 3 and 4.
|
2
|
+
|
3
|
+
if Mongoid::VERSION =~ /\A3\./
|
4
|
+
|
5
|
+
::Mongoid::Indexes::Validators::Options.send(:remove_const, :VALID_OPTIONS)
|
6
|
+
module Mongoid::Indexes::Validators::Options
|
7
|
+
VALID_OPTIONS = [
|
8
|
+
:background,
|
9
|
+
:database,
|
10
|
+
:default_language,
|
11
|
+
:language_override,
|
12
|
+
:drop_dups,
|
13
|
+
:name,
|
14
|
+
:sparse,
|
15
|
+
:unique,
|
16
|
+
:max,
|
17
|
+
:min,
|
18
|
+
:bits,
|
19
|
+
:bucket_size,
|
20
|
+
:expire_after_seconds,
|
21
|
+
:weights,
|
22
|
+
:storage_engine,
|
23
|
+
:sphere_version,
|
24
|
+
:text_version,
|
25
|
+
:version,
|
26
|
+
:partial_filter_expression,
|
27
|
+
:collation
|
28
|
+
]
|
29
|
+
end
|
30
|
+
|
31
|
+
elsif Mongoid::VERSION =~ /\A4\./
|
32
|
+
|
33
|
+
::Mongoid::Indexable::Validators::Options.send(:remove_const, :VALID_OPTIONS)
|
34
|
+
module Mongoid::Indexable::Validators::Options
|
35
|
+
VALID_OPTIONS = [
|
36
|
+
:background,
|
37
|
+
:database,
|
38
|
+
:default_language,
|
39
|
+
:language_override,
|
40
|
+
:drop_dups,
|
41
|
+
:name,
|
42
|
+
:sparse,
|
43
|
+
:unique,
|
44
|
+
:max,
|
45
|
+
:min,
|
46
|
+
:bits,
|
47
|
+
:bucket_size,
|
48
|
+
:expire_after_seconds,
|
49
|
+
:weights,
|
50
|
+
:storage_engine,
|
51
|
+
:sphere_version,
|
52
|
+
:text_version,
|
53
|
+
:version,
|
54
|
+
:partial_filter_expression,
|
55
|
+
:collation
|
56
|
+
]
|
57
|
+
end
|
58
|
+
end
|
data/lib/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
if Mongoid::VERSION =~ /\A[34]\./
|
4
|
+
|
5
|
+
describe 'Index Valid Options' do
|
6
|
+
let(:mod){ Mongoid::VERSION =~ /\A3\./ ? Mongoid::Indexes::Validators : Mongoid::Indexable::Validators }
|
7
|
+
let(:exp) do
|
8
|
+
[ :background,
|
9
|
+
:database,
|
10
|
+
:default_language,
|
11
|
+
:language_override,
|
12
|
+
:drop_dups,
|
13
|
+
:name,
|
14
|
+
:sparse,
|
15
|
+
:unique,
|
16
|
+
:max,
|
17
|
+
:min,
|
18
|
+
:bits,
|
19
|
+
:bucket_size,
|
20
|
+
:expire_after_seconds,
|
21
|
+
:weights,
|
22
|
+
:storage_engine,
|
23
|
+
:sphere_version,
|
24
|
+
:text_version,
|
25
|
+
:version,
|
26
|
+
:partial_filter_expression,
|
27
|
+
:collation ]
|
28
|
+
end
|
29
|
+
it { expect(mod::Options::VALID_OPTIONS).to eq(exp) }
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_monkey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- johnnyshields
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- lib/patches/big_decimal.rb
|
68
68
|
- lib/patches/db_commands.rb
|
69
69
|
- lib/patches/embedded_touch.rb
|
70
|
+
- lib/patches/index_options.rb
|
70
71
|
- lib/patches/instrument.rb
|
71
72
|
- lib/patches/only_pluck_localized.rb
|
72
73
|
- lib/patches/reorder.rb
|
@@ -112,6 +113,7 @@ files:
|
|
112
113
|
- spec/unit/db_commands/moped_database_spec.rb
|
113
114
|
- spec/unit/db_commands/moped_indexes_spec.rb
|
114
115
|
- spec/unit/embedded_touch_spec.rb
|
116
|
+
- spec/unit/index_options_spec.rb
|
115
117
|
- spec/unit/instrument_spec.rb
|
116
118
|
- spec/unit/only_pluck_localized_spec.rb
|
117
119
|
- spec/unit/reorder_spec.rb
|
@@ -181,6 +183,7 @@ test_files:
|
|
181
183
|
- spec/unit/db_commands/moped_database_spec.rb
|
182
184
|
- spec/unit/db_commands/moped_indexes_spec.rb
|
183
185
|
- spec/unit/embedded_touch_spec.rb
|
186
|
+
- spec/unit/index_options_spec.rb
|
184
187
|
- spec/unit/instrument_spec.rb
|
185
188
|
- spec/unit/only_pluck_localized_spec.rb
|
186
189
|
- spec/unit/reorder_spec.rb
|