mongoid-scroll 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +25 -10
- data/.travis.yml +22 -12
- data/CHANGELOG.md +10 -4
- data/Dangerfile +1 -0
- data/Gemfile +7 -2
- data/README.md +7 -8
- data/RELEASING.md +1 -1
- data/examples/mongo_ruby_driver_scroll_feed.rb +1 -1
- data/examples/moped_scroll_feed.rb +1 -1
- data/lib/config/locales/en.yml +1 -1
- data/lib/mongo/scrollable.rb +3 -2
- data/lib/mongoid/criterion/scrollable.rb +1 -1
- data/lib/mongoid/scroll/cursor.rb +15 -11
- data/lib/mongoid/scroll/errors/base.rb +1 -1
- data/lib/mongoid/scroll/version.rb +1 -1
- data/lib/moped/scrollable.rb +1 -1
- data/mongoid-scroll.gemspec +1 -1
- data/spec/mongoid/criteria_spec.rb +2 -2
- data/spec/mongoid/scroll_cursor_spec.rb +22 -22
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57a1e903af68213f7d6552ca5dc91515ef599fcd
|
4
|
+
data.tar.gz: f957cb76b0556ba653b2a56d030850c07ed995c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4df4fa326bfb87fa7cb41e577e4cf22010415e2cedaa74f52a7b789f72143bcc2f5c6074f3823f95705c3090fef4a75d7b365d3274a8ff640105d429918b08f
|
7
|
+
data.tar.gz: cacbb8b7577052c47fac14aa4401117dfb6c05a788e900d252fac0c565d49c24b6512deb87c02f69ab3803ce4348820bdfe78e6f99309516be5d45cc9bf66229
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2016-09-27 11:32:40 -0700 using RuboCop version 0.43.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -8,18 +8,19 @@
|
|
8
8
|
|
9
9
|
# Offense count: 6
|
10
10
|
Metrics/AbcSize:
|
11
|
-
Max:
|
11
|
+
Max: 67
|
12
12
|
|
13
13
|
# Offense count: 6
|
14
14
|
Metrics/CyclomaticComplexity:
|
15
15
|
Max: 11
|
16
16
|
|
17
|
-
# Offense count:
|
18
|
-
# Configuration parameters: AllowURI, URISchemes.
|
17
|
+
# Offense count: 114
|
18
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
|
19
|
+
# URISchemes: http, https
|
19
20
|
Metrics/LineLength:
|
20
21
|
Max: 170
|
21
22
|
|
22
|
-
# Offense count:
|
23
|
+
# Offense count: 6
|
23
24
|
# Configuration parameters: CountComments.
|
24
25
|
Metrics/MethodLength:
|
25
26
|
Max: 25
|
@@ -28,9 +29,11 @@ Metrics/MethodLength:
|
|
28
29
|
Metrics/PerceivedComplexity:
|
29
30
|
Max: 11
|
30
31
|
|
31
|
-
# Offense count:
|
32
|
+
# Offense count: 10
|
32
33
|
Style/Documentation:
|
33
34
|
Exclude:
|
35
|
+
- 'spec/**/*'
|
36
|
+
- 'test/**/*'
|
34
37
|
- 'examples/mongoid_scroll_feed.rb'
|
35
38
|
- 'lib/mongo/scrollable.rb'
|
36
39
|
- 'lib/mongoid/criterion/scrollable.rb'
|
@@ -40,18 +43,30 @@ Style/Documentation:
|
|
40
43
|
- 'lib/mongoid/scroll/errors/multiple_sort_fields_error.rb'
|
41
44
|
- 'lib/mongoid/scroll/errors/no_such_field_error.rb'
|
42
45
|
- 'lib/mongoid/scroll/errors/unsupported_field_type_error.rb'
|
43
|
-
- 'lib/mongoid/scroll/version.rb'
|
44
46
|
- 'lib/moped/scrollable.rb'
|
45
|
-
- 'spec/support/feed/embedded_item.rb'
|
46
|
-
- 'spec/support/feed/item.rb'
|
47
47
|
|
48
48
|
# Offense count: 1
|
49
|
-
# Configuration parameters:
|
49
|
+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
|
50
50
|
Style/FileName:
|
51
51
|
Exclude:
|
52
52
|
- 'lib/mongoid-scroll.rb'
|
53
53
|
|
54
|
+
# Offense count: 2
|
55
|
+
# Configuration parameters: MinBodyLength.
|
56
|
+
Style/GuardClause:
|
57
|
+
Exclude:
|
58
|
+
- 'lib/mongoid/criterion/scrollable.rb'
|
59
|
+
- 'lib/moped/scrollable.rb'
|
60
|
+
|
54
61
|
# Offense count: 7
|
62
|
+
# Cop supports --auto-correct.
|
55
63
|
# Configuration parameters: SupportedStyles.
|
64
|
+
# SupportedStyles: compact, exploded
|
56
65
|
Style/RaiseArgs:
|
57
66
|
EnforcedStyle: compact
|
67
|
+
|
68
|
+
# Offense count: 1
|
69
|
+
# Configuration parameters: SupportedStyles.
|
70
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
71
|
+
Style/VariableNumber:
|
72
|
+
EnforcedStyle: normalcase
|
data/.travis.yml
CHANGED
@@ -1,18 +1,28 @@
|
|
1
1
|
services:
|
2
2
|
- mongodb
|
3
3
|
|
4
|
-
rvm:
|
5
|
-
- 1.9.3
|
6
|
-
- 2.0.0
|
7
|
-
- 2.1.2
|
8
|
-
- jruby-19mode
|
9
|
-
- rbx-2
|
10
|
-
|
11
|
-
env:
|
12
|
-
- MONGOID_VERSION=3
|
13
|
-
- MONGOID_VERSION=4
|
14
|
-
- MONGOID_VERSION=5
|
15
|
-
|
16
4
|
language: ruby
|
17
5
|
|
18
6
|
cache: bundler
|
7
|
+
|
8
|
+
before_install:
|
9
|
+
- gem update --system
|
10
|
+
- gem install bundler
|
11
|
+
|
12
|
+
matrix:
|
13
|
+
include:
|
14
|
+
- rvm: 2.3.1
|
15
|
+
env: MONGOID_VERSION=3
|
16
|
+
- rvm: 2.3.1
|
17
|
+
env: MONGOID_VERSION=4
|
18
|
+
- rvm: 2.3.1
|
19
|
+
env: MONGOID_VERSION=5
|
20
|
+
- rvm: 2.3.1
|
21
|
+
env: MONGOID_VERSION=6
|
22
|
+
- rvm: 2.3.1
|
23
|
+
env: MONGOID_VERSION=HEAD
|
24
|
+
- rvm: 2.3.1
|
25
|
+
script:
|
26
|
+
- bundle exec danger
|
27
|
+
|
28
|
+
bundler_args: --without development
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
+
0.3.5 (2016/09/27)
|
2
|
+
------------------
|
3
|
+
|
4
|
+
* [#11](https://github.com/mongoid/mongoid-scroll/pull/11): Compatibility with Mongoid 6 - [@dblock](https://github.com/dblock).
|
5
|
+
* [#12](https://github.com/mongoid/mongoid-scroll/pull/12): Added Danger, PR linter - [@dblock](https://github.com/dblock).
|
6
|
+
|
1
7
|
0.3.4 (2015/10/22)
|
2
8
|
------------------
|
3
9
|
|
4
|
-
* Added support for [mongo-ruby-driver](https://github.com/mongodb/mongo-ruby-driver), `Mongo::Collection::View
|
10
|
+
* Added support for [mongo-ruby-driver](https://github.com/mongodb/mongo-ruby-driver), `Mongo::Collection::View` - [@dblock](https://github.com/dblock).
|
5
11
|
|
6
12
|
0.3.3 (2015/09/17)
|
7
13
|
------------------
|
@@ -11,14 +17,14 @@
|
|
11
17
|
0.3.2 (2015/8/8)
|
12
18
|
----------------
|
13
19
|
|
14
|
-
* [#7](https://github.com/
|
20
|
+
* [#7](https://github.com/mongoid/mongoid-scroll/pull/7): Fix: pre-merge cursor criteria fields - [@sweir27](https://github.com/sweir27).
|
15
21
|
|
16
22
|
0.3.1 (2015/7/27)
|
17
23
|
-----------------
|
18
24
|
|
19
25
|
* Compatibility with Mongoid 5.x beta - [@dblock](https://github.com/dblock).
|
20
|
-
* [#4](https://github.com/
|
21
|
-
* [#5](https://github.com/
|
26
|
+
* [#4](https://github.com/mongoid/mongoid-scroll/pull/4): Fix: support chaining `$or` criteria - [@sweir27](https://github.com/sweir27).
|
27
|
+
* [#5](https://github.com/mongoid/mongoid-scroll/pull/5): Fix: embeddable objects now returned in pagination - [@sweir27](https://github.com/sweir27).
|
22
28
|
|
23
29
|
0.3.0 (2014/1/7)
|
24
30
|
----------------
|
data/Dangerfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
danger.import_dangerfile(gem: 'mongoid-danger')
|
data/Gemfile
CHANGED
@@ -2,7 +2,11 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
case version = ENV['MONGOID_VERSION'] || '~>
|
5
|
+
case version = ENV['MONGOID_VERSION'] || '~> 6.0'
|
6
|
+
when 'HEAD'
|
7
|
+
gem 'mongoid', github: 'mongodb/mongoid'
|
8
|
+
when /6/
|
9
|
+
gem 'mongoid', '~> 6.0'
|
6
10
|
when /5/
|
7
11
|
gem 'mongoid', '~> 5.0'
|
8
12
|
when /4/
|
@@ -19,5 +23,6 @@ group :development, :test do
|
|
19
23
|
gem 'rspec', '~> 3.0'
|
20
24
|
gem 'rspec-its'
|
21
25
|
gem 'faker'
|
22
|
-
gem 'rubocop', '0.
|
26
|
+
gem 'rubocop', '0.43.0'
|
27
|
+
gem 'mongoid-danger', '~> 0.1.0', require: false
|
23
28
|
end
|
data/README.md
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
Mongoid::Scroll
|
2
2
|
===============
|
3
3
|
|
4
|
-
[![Gem Version](
|
5
|
-
[![Build Status](
|
6
|
-
[![Dependency Status](https://gemnasium.com/
|
7
|
-
[![Code Climate](https://codeclimate.com/github/
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/mongoid-scroll.svg)](https://badge.fury.io/rb/mongoid-scroll)
|
5
|
+
[![Build Status](https://travis-ci.org/mongoid/mongoid-scroll.svg?branch=master)](https://travis-ci.org/mongoid/mongoid-scroll)
|
6
|
+
[![Dependency Status](https://gemnasium.com/mongoid/mongoid-scroll.svg)](https://gemnasium.com/mongoid/mongoid-scroll)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/mongoid/mongoid-scroll.svg)](https://codeclimate.com/github/mongoid/mongoid-scroll)
|
8
8
|
|
9
|
-
|
10
|
-
Mongoid extension that enables infinite scrolling for `Mongoid::Criteria` and `Moped::Query`.
|
9
|
+
Mongoid extension that enables infinite scrolling for `Mongoid::Criteria`, `Moped::Query` and `Mongo::Collection::View`.
|
11
10
|
|
12
11
|
Compatibility
|
13
12
|
-------------
|
14
13
|
|
15
|
-
This gem supports Mongoid 3, 4
|
14
|
+
This gem supports Mongoid 3, 4, 5, 6, Moped and Mongo-Ruby-Driver.
|
16
15
|
|
17
16
|
Demo
|
18
17
|
----
|
@@ -185,6 +184,6 @@ Fork the project. Make your feature addition or bug fix with tests. Send a pull
|
|
185
184
|
Copyright and License
|
186
185
|
---------------------
|
187
186
|
|
188
|
-
MIT License, see [LICENSE](http://github.com/
|
187
|
+
MIT License, see [LICENSE](http://github.com/mongoid/mongoid-scroll/raw/master/LICENSE.md) for details.
|
189
188
|
|
190
189
|
(c) 2013-2015 [Daniel Doubrovkine](http://github.com/dblock), based on code by [Frank Macreery](http://github.com/macreery), [Artsy Inc.](http://artsy.net)
|
data/RELEASING.md
CHANGED
@@ -12,7 +12,7 @@ bundle install
|
|
12
12
|
rake
|
13
13
|
```
|
14
14
|
|
15
|
-
Check that the last build succeeded in [Travis CI](https://travis-ci.org/
|
15
|
+
Check that the last build succeeded in [Travis CI](https://travis-ci.org/mongoid/mongoid-scroll) for all supported platforms.
|
16
16
|
|
17
17
|
Increment the version, modify [lib/mongoid/scroll/version.rb](lib/mongoid/scroll/version.rb).
|
18
18
|
|
@@ -4,7 +4,7 @@ Bundler.setup(:default, :development)
|
|
4
4
|
require 'mongoid-scroll'
|
5
5
|
require 'faker'
|
6
6
|
|
7
|
-
|
7
|
+
raise 'No Mongo Ruby Driver' unless Object.const_defined?(:Mongo)
|
8
8
|
|
9
9
|
Mongo::Logger.logger = Logger.new($stdout)
|
10
10
|
Mongo::Logger.logger.level = Logger::INFO
|
data/lib/config/locales/en.yml
CHANGED
@@ -18,5 +18,5 @@ en:
|
|
18
18
|
unsupported_field_type:
|
19
19
|
message: "Unsupported field type."
|
20
20
|
summary: "The type of the field '%{field}' is not supported: %{type}."
|
21
|
-
resolution: "Please open a feature request in https://github.com/
|
21
|
+
resolution: "Please open a feature request in https://github.com/mongoid/mongoid-scroll."
|
22
22
|
|
data/lib/mongo/scrollable.rb
CHANGED
@@ -3,7 +3,7 @@ module Mongo
|
|
3
3
|
def scroll(cursor = nil, options = nil, &_block)
|
4
4
|
view = self
|
5
5
|
# we don't support scrolling over a view with multiple fields
|
6
|
-
|
6
|
+
raise Mongoid::Scroll::Errors::MultipleSortFieldsError.new(sort: view.sort) if view.sort && view.sort.keys.size != 1
|
7
7
|
# scroll field and direction
|
8
8
|
scroll_field = view.sort ? view.sort.keys.first : :_id
|
9
9
|
scroll_direction = view.sort ? view.sort.values.first.to_i : 1
|
@@ -17,7 +17,8 @@ module Mongo
|
|
17
17
|
view.selector.merge(cursor.criteria),
|
18
18
|
sort: (view.sort || {}).merge(_id: scroll_direction),
|
19
19
|
skip: skip,
|
20
|
-
limit: limit
|
20
|
+
limit: limit
|
21
|
+
)
|
21
22
|
# scroll
|
22
23
|
if block_given?
|
23
24
|
view.each do |record|
|
@@ -5,7 +5,7 @@ module Mongoid
|
|
5
5
|
criteria = self
|
6
6
|
# we don't support scrolling over a criteria with multiple fields
|
7
7
|
if criteria.options[:sort] && criteria.options[:sort].keys.size != 1
|
8
|
-
|
8
|
+
raise Mongoid::Scroll::Errors::MultipleSortFieldsError.new(sort: criteria.options[:sort])
|
9
9
|
elsif !criteria.options.key?(:sort) || criteria.options[:sort].empty?
|
10
10
|
# introduce a default sort order if there's none
|
11
11
|
criteria = criteria.asc(:_id)
|
@@ -14,8 +14,12 @@ module Mongoid
|
|
14
14
|
compare_direction = direction == 1 ? '$gt' : '$lt'
|
15
15
|
cursor_criteria = { field_name => { compare_direction => mongo_value } } if mongo_value
|
16
16
|
tiebreak_criteria = { field_name => mongo_value, :_id => { compare_direction => tiebreak_id } } if mongo_value && tiebreak_id
|
17
|
-
cursor_selector =
|
18
|
-
|
17
|
+
cursor_selector = if Mongoid::Compatibility::Version.mongoid6?
|
18
|
+
Mongoid::Criteria::Queryable::Selector.new
|
19
|
+
else
|
20
|
+
Origin::Selector.new
|
21
|
+
end
|
22
|
+
cursor_selector['$or'] = [cursor_criteria, tiebreak_criteria].compact if cursor_criteria || tiebreak_criteria
|
19
23
|
cursor_selector.__evolve_object_id__
|
20
24
|
end
|
21
25
|
|
@@ -39,16 +43,16 @@ module Mongoid
|
|
39
43
|
return unless value
|
40
44
|
parts = value.split(':')
|
41
45
|
unless parts.length >= 2
|
42
|
-
|
46
|
+
raise Mongoid::Scroll::Errors::InvalidCursorError.new(cursor: value)
|
43
47
|
end
|
44
48
|
id = parts[-1]
|
45
49
|
value = parts[0...-1].join(':')
|
46
50
|
@value = Mongoid::Scroll::Cursor.parse_field_value(field_type, field_name, value)
|
47
|
-
if Mongoid::Compatibility::Version.mongoid3?
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
@tiebreak_id = if Mongoid::Compatibility::Version.mongoid3?
|
52
|
+
Moped::BSON::ObjectId(id)
|
53
|
+
else
|
54
|
+
BSON::ObjectId.from_string(id)
|
55
|
+
end
|
52
56
|
end
|
53
57
|
|
54
58
|
class << self
|
@@ -58,7 +62,7 @@ module Mongoid
|
|
58
62
|
elsif options && (field = options[:field])
|
59
63
|
[field.type.to_s, field.name.to_s]
|
60
64
|
else
|
61
|
-
|
65
|
+
raise ArgumentError.new 'Missing options[:field_name] and/or options[:field_type].'
|
62
66
|
end
|
63
67
|
end
|
64
68
|
|
@@ -72,7 +76,7 @@ module Mongoid
|
|
72
76
|
when 'Float' then value.to_f
|
73
77
|
when 'Integer' then value.to_i
|
74
78
|
else
|
75
|
-
|
79
|
+
raise Mongoid::Scroll::Errors::UnsupportedFieldTypeError.new(field: field_name, type: field_type)
|
76
80
|
end
|
77
81
|
end
|
78
82
|
|
@@ -85,7 +89,7 @@ module Mongoid
|
|
85
89
|
when 'Float' then value.to_f
|
86
90
|
when 'Integer' then value.to_i
|
87
91
|
else
|
88
|
-
|
92
|
+
raise Mongoid::Scroll::Errors::UnsupportedFieldTypeError.new(field: field_name, type: field_type)
|
89
93
|
end
|
90
94
|
end
|
91
95
|
end
|
data/lib/moped/scrollable.rb
CHANGED
@@ -10,7 +10,7 @@ module Moped
|
|
10
10
|
query.operation.limit = operation.limit
|
11
11
|
# we don't support scrolling over a criteria with multiple fields
|
12
12
|
if query.operation.selector['$orderby'] && query.operation.selector['$orderby'].keys.size != 1
|
13
|
-
|
13
|
+
raise Mongoid::Scroll::Errors::MultipleSortFieldsError.new(sort: query.operation.selector['$orderby'])
|
14
14
|
elsif !query.operation.selector.key?('$orderby') || query.operation.selector['$orderby'].empty?
|
15
15
|
# introduce a default sort order if there's none
|
16
16
|
query.sort(_id: 1)
|
data/mongoid-scroll.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.required_rubygems_version = '>= 1.3.6'
|
11
11
|
s.files = `git ls-files`.split("\n")
|
12
12
|
s.require_paths = ['lib']
|
13
|
-
s.homepage = 'http://github.com/
|
13
|
+
s.homepage = 'http://github.com/mongoid/mongoid-scroll'
|
14
14
|
s.licenses = ['MIT']
|
15
15
|
s.summary = 'Mongoid extensions to enable infinite scroll.'
|
16
16
|
s.add_dependency 'mongoid', '>= 3.0'
|
@@ -132,8 +132,8 @@ describe Mongoid::Criteria do
|
|
132
132
|
end
|
133
133
|
it 'merges cursor criteria when no sort field is given' do
|
134
134
|
criteria = Feed::Item.where(:a_time.gt => Time.new(2013, 7, 22, 1, 2, 3))
|
135
|
-
|
136
|
-
cursor_input = "#{
|
135
|
+
feed_item = Feed::Item.where(name: 'Feed Item 1').first
|
136
|
+
cursor_input = "#{feed_item.id}:#{feed_item.id}"
|
137
137
|
field_type = Mongoid::Compatibility::Version.mongoid3? ? Moped::BSON::ObjectId : BSON::ObjectId
|
138
138
|
cursor_options = { field_type: field_type, field_name: '_id', direction: 1 }
|
139
139
|
cursor = Mongoid::Scroll::Cursor.new(cursor_input, cursor_options)
|
@@ -26,12 +26,12 @@ describe Mongoid::Scroll::Cursor do
|
|
26
26
|
its(:criteria) do
|
27
27
|
if Mongoid::Compatibility::Version.mongoid3?
|
28
28
|
should eq('$or' => [
|
29
|
-
|
30
|
-
|
29
|
+
{ '_id' => { '$gt' => Moped::BSON::ObjectId(feed_item.id.to_s) } }
|
30
|
+
])
|
31
31
|
else
|
32
32
|
should eq('$or' => [
|
33
|
-
|
34
|
-
|
33
|
+
{ '_id' => { '$gt' => BSON::ObjectId(feed_item.id.to_s) } }
|
34
|
+
])
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -44,9 +44,9 @@ describe Mongoid::Scroll::Cursor do
|
|
44
44
|
its(:tiebreak_id) { should eq feed_item.id }
|
45
45
|
its(:criteria) do
|
46
46
|
should eq('$or' => [
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
{ 'a_string' => { '$gt' => feed_item.a_string } },
|
48
|
+
{ 'a_string' => feed_item.a_string, '_id' => { '$gt' => feed_item.id } }
|
49
|
+
])
|
50
50
|
end
|
51
51
|
end
|
52
52
|
context 'an integer field cursor' do
|
@@ -58,9 +58,9 @@ describe Mongoid::Scroll::Cursor do
|
|
58
58
|
its(:tiebreak_id) { should eq feed_item.id }
|
59
59
|
its(:criteria) do
|
60
60
|
should eq('$or' => [
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
{ 'a_integer' => { '$gt' => feed_item.a_integer } },
|
62
|
+
{ 'a_integer' => feed_item.a_integer, '_id' => { '$gt' => feed_item.id } }
|
63
|
+
])
|
64
64
|
end
|
65
65
|
end
|
66
66
|
context 'a date/time field cursor' do
|
@@ -73,9 +73,9 @@ describe Mongoid::Scroll::Cursor do
|
|
73
73
|
its(:to_s) { should eq "#{feed_item.a_datetime.utc.to_i}:#{feed_item.id}" }
|
74
74
|
its(:criteria) do
|
75
75
|
should eq('$or' => [
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
{ 'a_datetime' => { '$gt' => feed_item.a_datetime } },
|
77
|
+
{ 'a_datetime' => feed_item.a_datetime, '_id' => { '$gt' => feed_item.id } }
|
78
|
+
])
|
79
79
|
end
|
80
80
|
end
|
81
81
|
context 'a date field cursor' do
|
@@ -88,9 +88,9 @@ describe Mongoid::Scroll::Cursor do
|
|
88
88
|
its(:to_s) { should eq "#{feed_item.a_date.to_datetime.to_i}:#{feed_item.id}" }
|
89
89
|
its(:criteria) do
|
90
90
|
should eq('$or' => [
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
{ 'a_date' => { '$gt' => feed_item.a_date.to_datetime } },
|
92
|
+
{ 'a_date' => feed_item.a_date.to_datetime, '_id' => { '$gt' => feed_item.id } }
|
93
|
+
])
|
94
94
|
end
|
95
95
|
end
|
96
96
|
context 'a time field cursor' do
|
@@ -103,9 +103,9 @@ describe Mongoid::Scroll::Cursor do
|
|
103
103
|
its(:to_s) { should eq "#{feed_item.a_time.to_i}:#{feed_item.id}" }
|
104
104
|
its(:criteria) do
|
105
105
|
should eq('$or' => [
|
106
|
-
|
107
|
-
|
108
|
-
|
106
|
+
{ 'a_time' => { '$gt' => feed_item.a_time } },
|
107
|
+
{ 'a_time' => feed_item.a_time, '_id' => { '$gt' => feed_item.id } }
|
108
|
+
])
|
109
109
|
end
|
110
110
|
end
|
111
111
|
context 'a time field cursor with a field option' do
|
@@ -118,9 +118,9 @@ describe Mongoid::Scroll::Cursor do
|
|
118
118
|
its(:to_s) { should eq "#{feed_item.a_time.to_i}:#{feed_item.id}" }
|
119
119
|
its(:criteria) do
|
120
120
|
should eq('$or' => [
|
121
|
-
|
122
|
-
|
123
|
-
|
121
|
+
{ 'a_time' => { '$gt' => feed_item.a_time } },
|
122
|
+
{ 'a_time' => feed_item.a_time, '_id' => { '$gt' => feed_item.id } }
|
123
|
+
])
|
124
124
|
end
|
125
125
|
end
|
126
126
|
context 'an array field cursor' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-scroll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
@@ -9,48 +9,48 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-09-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '3.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '3.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: mongoid-compatibility
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: i18n
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
description:
|
@@ -59,12 +59,13 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
63
|
-
- .rspec
|
64
|
-
- .rubocop.yml
|
65
|
-
- .rubocop_todo.yml
|
66
|
-
- .travis.yml
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".rubocop_todo.yml"
|
66
|
+
- ".travis.yml"
|
67
67
|
- CHANGELOG.md
|
68
|
+
- Dangerfile
|
68
69
|
- Gemfile
|
69
70
|
- LICENSE.md
|
70
71
|
- README.md
|
@@ -96,7 +97,7 @@ files:
|
|
96
97
|
- spec/spec_helper.rb
|
97
98
|
- spec/support/feed/embedded_item.rb
|
98
99
|
- spec/support/feed/item.rb
|
99
|
-
homepage: http://github.com/
|
100
|
+
homepage: http://github.com/mongoid/mongoid-scroll
|
100
101
|
licenses:
|
101
102
|
- MIT
|
102
103
|
metadata: {}
|
@@ -106,17 +107,17 @@ require_paths:
|
|
106
107
|
- lib
|
107
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
109
|
requirements:
|
109
|
-
- -
|
110
|
+
- - ">="
|
110
111
|
- !ruby/object:Gem::Version
|
111
112
|
version: '0'
|
112
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
114
|
requirements:
|
114
|
-
- -
|
115
|
+
- - ">="
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: 1.3.6
|
117
118
|
requirements: []
|
118
119
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.5.1
|
120
121
|
signing_key:
|
121
122
|
specification_version: 4
|
122
123
|
summary: Mongoid extensions to enable infinite scroll.
|