Skip to content

Support mongoid 6. #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -17,17 +17,9 @@ matrix:
env: MONGOID_VERSION=4
- rvm: 2.3.1
env: MONGOID_VERSION=5
- rvm: 2.3.0
- rvm: 2.2.5
- rvm: 2.1.10
- rvm: 2.0.0
- rvm: 1.9.3
- rvm: rbx-2
- rvm: ruby-head
- rvm: jruby-head
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
- rvm: rbx-2
- rvm: 2.3.1
env: MONGOID_VERSION=6
- rvm: 2.3.1
env: MONGOID_VERSION=HEAD

bundler_args: --without development
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.3.5 (Next)
------------

* [#11](https://github.com/mongoid/mongoid-scroll/pull/11): Compatibility with Mongoid 6 - [@dblock](https://github.com/dblock).
* Your contribution here.

0.3.4 (2015/10/22)
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -2,7 +2,11 @@ source 'http://rubygems.org'

gemspec

case version = ENV['MONGOID_VERSION'] || '~> 5.0'
case version = ENV['MONGOID_VERSION'] || '~> 6.0'
when 'HEAD'
gem 'mongoid', github: 'mongodb/mongoid'
when /6/
gem 'mongoid', '~> 6.0'
when /5/
gem 'mongoid', '~> 5.0'
when /4/
6 changes: 5 additions & 1 deletion lib/mongoid/scroll/cursor.rb
Original file line number Diff line number Diff line change
@@ -14,7 +14,11 @@ def criteria
compare_direction = direction == 1 ? '$gt' : '$lt'
cursor_criteria = { field_name => { compare_direction => mongo_value } } if mongo_value
tiebreak_criteria = { field_name => mongo_value, :_id => { compare_direction => tiebreak_id } } if mongo_value && tiebreak_id
cursor_selector = Origin::Selector.new
cursor_selector = if Mongoid::Compatibility::Version.mongoid6?
Mongoid::Criteria::Queryable::Selector.new
else
Origin::Selector.new
end
cursor_selector.merge!('$or' => [cursor_criteria, tiebreak_criteria].compact) if cursor_criteria || tiebreak_criteria
cursor_selector.__evolve_object_id__
end