mongoid_ruby_or 0.1.0 → 0.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 +7 -0
- data/README.md +10 -2
- data/lib/mongoid_ruby_or.rb +1 -1
- data/mongoid_ruby_or-0.1.0.gem +0 -0
- data/mongoid_ruby_or-0.2.0.gem +0 -0
- data/mongoid_ruby_or.gemspec +2 -2
- data/test/mongoid.yml +2 -2
- metadata +16 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8c2168ae6d3f080b174ca791bd9836de3619e783
|
4
|
+
data.tar.gz: 3d131204f5229eccd312b9122c8cca208788e9c6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 609ecd92a6b2bb9cf228d71a7fcf1bf9d5205089b59df01e9431157fda8d6e702864d222ff31808285c74c6de0da5bb51d39e6419b07b9344fcf0ee4f8b94f62
|
7
|
+
data.tar.gz: afc244170b0850d38dd1dd7929b9e1a9fe5a2ebbe030ced570cd59501b0a924182b7962c5ef838fdb5505f03afe1b0ea10cb1b1cbf022bb251089c97f4df11b6
|
data/README.md
CHANGED
@@ -57,7 +57,7 @@ index({ content_id: 1, brand_id: 1 })
|
|
57
57
|
|
58
58
|
```
|
59
59
|
|
60
|
-
So in this
|
60
|
+
So in this simplified case, we will need to add an extra index.
|
61
61
|
|
62
62
|
Sometimes is not worth it, maybe that query is not use very often to justify the necessity to maintain the index, or you are trying to cut back on indexes for that collection.
|
63
63
|
|
@@ -71,6 +71,13 @@ Add to your Gemfile:
|
|
71
71
|
gem :mongoid_ruby_or
|
72
72
|
```
|
73
73
|
|
74
|
+
For mongoid v3.x use:
|
75
|
+
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
gem :mongoid_ruby_or, '0.1.0'
|
79
|
+
```
|
80
|
+
|
74
81
|
## Usage
|
75
82
|
|
76
83
|
Using the same example from above:
|
@@ -87,7 +94,8 @@ brand.resources.or({name: /^test/}, {content_id: /^test/}).limit(10).ruby_or
|
|
87
94
|
|
88
95
|
## Some observations
|
89
96
|
|
90
|
-
*
|
97
|
+
* ~~**built for a system running ruby 1.9.3, rails 3.2, mongo 2.6.3, and mongoid 3.1.6**, may not be an issue in the future~~
|
98
|
+
* **built for a system running ruby 2.0.0, rails 4.2.6, mongo 2.6.3, and mongoid 5.1.1**, may not be an issue in the future
|
91
99
|
* tested for simple $or clauses
|
92
100
|
* can't do count for obvious reasons
|
93
101
|
* ruby_or will cut the criteria chain and get results as soon as invoked, so use at the end
|
data/lib/mongoid_ruby_or.rb
CHANGED
Binary file
|
Binary file
|
data/mongoid_ruby_or.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mongoid_ruby_or'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.2.0'
|
4
4
|
s.authors = ['Ary Djmal']
|
5
5
|
s.email = ['arydjmal@gmail.com']
|
6
6
|
s.summary = 'This gem hijacks the $or operator, doing one query per $or clause, merging the results with plain ruby.'
|
7
7
|
s.homepage = 'http://github.com/arydjmal/mongoid_ruby_or'
|
8
8
|
|
9
|
-
s.add_dependency 'mongoid', '~>
|
9
|
+
s.add_dependency 'mongoid', '~> 5.1'
|
10
10
|
|
11
11
|
s.add_development_dependency 'rake'
|
12
12
|
|
data/test/mongoid.yml
CHANGED
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_ruby_or
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ary Djmal
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: mongoid
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: '5.1'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: '5.1'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
description:
|
@@ -50,38 +45,38 @@ executables: []
|
|
50
45
|
extensions: []
|
51
46
|
extra_rdoc_files: []
|
52
47
|
files:
|
53
|
-
- ./lib/mongoid_ruby_or.rb
|
54
48
|
- ./MIT-LICENSE
|
55
|
-
- ./mongoid_ruby_or.gemspec
|
56
|
-
- ./Rakefile
|
57
49
|
- ./README.md
|
50
|
+
- ./Rakefile
|
51
|
+
- ./lib/mongoid_ruby_or.rb
|
52
|
+
- ./mongoid_ruby_or-0.1.0.gem
|
53
|
+
- ./mongoid_ruby_or-0.2.0.gem
|
54
|
+
- ./mongoid_ruby_or.gemspec
|
58
55
|
- ./test/mongoid.yml
|
59
56
|
- ./test/mongoid_ruby_or_test.rb
|
60
57
|
- ./test/test_helper.rb
|
61
58
|
homepage: http://github.com/arydjmal/mongoid_ruby_or
|
62
59
|
licenses: []
|
60
|
+
metadata: {}
|
63
61
|
post_install_message:
|
64
62
|
rdoc_options: []
|
65
63
|
require_paths:
|
66
64
|
- lib
|
67
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
66
|
requirements:
|
70
|
-
- -
|
67
|
+
- - '>='
|
71
68
|
- !ruby/object:Gem::Version
|
72
69
|
version: '0'
|
73
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
71
|
requirements:
|
76
|
-
- -
|
72
|
+
- - '>='
|
77
73
|
- !ruby/object:Gem::Version
|
78
74
|
version: '0'
|
79
75
|
requirements: []
|
80
76
|
rubyforge_project:
|
81
|
-
rubygems_version:
|
77
|
+
rubygems_version: 2.2.2
|
82
78
|
signing_key:
|
83
|
-
specification_version:
|
79
|
+
specification_version: 4
|
84
80
|
summary: This gem hijacks the $or operator, doing one query per $or clause, merging
|
85
81
|
the results with plain ruby.
|
86
82
|
test_files: []
|
87
|
-
has_rdoc:
|