Skip to content

Commit

Permalink
Point at rc, fix index and delete syntax changes
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Mar 21, 2015
1 parent 651f7df commit fc3e1d0
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 71 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
source "https://rubygems.org"

gem "mongo", :github => "mongodb/mongo-ruby-driver"

gemspec

gem "rake"
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def purge!
# @since 2.0.2
def truncate!
Sessions.default.database.collections.each do |collection|
collection.find.remove_many
collection.find.delete_many
end and true
end

Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/contextual/mongo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def count(document = false, &block)
# @since 3.0.0
def delete
self.count.tap do
query.remove_many
query.delete_many
end
end
alias :delete_all :delete
Expand Down
6 changes: 3 additions & 3 deletions lib/mongoid/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def create_indexes
key, options = spec.key, spec.options
if database = options[:database]
with(read: { mode: :primary }, database: database).
collection.indexes.create(key, options.except(:database))
collection.indexes.create_one(key, options.except(:database))
else
with(read: { mode: :primary }).collection.indexes.create(key, options)
with(read: { mode: :primary }).collection.indexes.create_one(key, options)
end
end and true
end
Expand All @@ -54,7 +54,7 @@ def remove_indexes
begin
collection.indexes.each do |spec|
unless spec["name"] == "_id_"
collection.indexes.drop(spec["key"])
collection.indexes.drop_one(spec["key"])
end
end
rescue Mongo::Error::OperationFailure; end
Expand Down
4 changes: 2 additions & 2 deletions lib/mongoid/persistable/deletable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def delete_as_embedded(options = {})
#
# @since 4.0.0
def delete_as_root
collection.find(atomic_selector).remove_one
collection.find(atomic_selector).delete_one
true
end

Expand Down Expand Up @@ -140,7 +140,7 @@ def delete_all(conditions = nil)
selector.merge!(_type: name) if hereditary?
coll = collection
deleted = coll.find(selector).count
coll.find(selector).remove_many
coll.find(selector).delete_many
deleted
end
end
Expand Down
18 changes: 0 additions & 18 deletions lib/mongoid/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,6 @@ def self.rescue_responses
end
end

config.after_initialize do
# Unicorn clears the START_CTX when a worker is forked, so if we have
# data in START_CTX then we know we're being preloaded. Unicorn does
# not provide application-level hooks for executing code after the
# process has forked, so we reconnect lazily.
if defined?(Unicorn) && !Unicorn::HttpServer::START_CTX.empty?
::Mongoid.default_session.disconnect if ::Mongoid.configured?
end

# Passenger provides the :starting_worker_process event for executing
# code after it has forked, so we use that and reconnect immediately.
if ::Mongoid::Config.running_with_passenger?
PhusionPassenger.on_event(:starting_worker_process) do |forked|
::Mongoid.default_session.disconnect if forked
end
end
end

# Rails runs all initializers first before getting into any generator
# code, so we have no way in the intitializer to know if we are
# generating a mongoid.yml. So instead of failing, we catch all the
Expand Down
23 changes: 0 additions & 23 deletions lib/mongoid/support/query_counter.rb

This file was deleted.

2 changes: 1 addition & 1 deletion mongoid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|

s.add_dependency("activemodel", ["~> 4.0"])
s.add_dependency("tzinfo", [">= 0.3.37"])
s.add_dependency("mongo", ["2.0.0.alpha"])
s.add_dependency("mongo", ["2.0.0.rc"])
s.add_dependency("origin", ["~> 2.1"])

s.files = Dir.glob("lib/**/*") + %w(CHANGELOG.md LICENSE README.md Rakefile)
Expand Down
18 changes: 0 additions & 18 deletions spec/helpers.rb

This file was deleted.

2 changes: 0 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
require "action_controller"
require "mongoid"
require "rspec"
require "helpers"

# These environment variables can be set if wanting to test against a database
# that is not on the local machine.
Expand Down Expand Up @@ -118,7 +117,6 @@ class Application < Rails::Application
I18n.config.enforce_available_locales = false

RSpec.configure do |config|
config.include Mongoid::SpecHelpers
config.raise_errors_for_deprecations!

config.before(:suite) do
Expand Down

0 comments on commit fc3e1d0

Please sign in to comment.