You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get undefined method 'database' for Mongoid::Module
I ended up monkey patching the code such that the if ::Mongoid::VERSION < '3' statements are no longer required i.e. I know I only want to execute the other branches
module MongoidAutoInc
class Incrementor
class Sequence
def collection
Mongoid.default_session[@collection]
end
def update_number_with(mongo_func)
opts = {
"query" => query,
"update" => mongo_func,
"new" => true # return the modified document
}
collection.database.command({findandmodify: collection.name}.merge(opts))['value']['number']
end
end
end
end
NOTE: ::Mongoid::VERSION is returning 3.0.0.rc (alas I can't upgrade to latest Mongoid as the latest Moped requires Ruby 1.9.3 and I stuck on 1.9.2 for now)
The text was updated successfully, but these errors were encountered:
I get undefined method 'database' for Mongoid::Module
I ended up monkey patching the code such that the
if ::Mongoid::VERSION < '3'
statements are no longer required i.e. I know I only want to execute the other branchesNOTE: ::Mongoid::VERSION is returning 3.0.0.rc (alas I can't upgrade to latest Mongoid as the latest Moped requires Ruby 1.9.3 and I stuck on 1.9.2 for now)
The text was updated successfully, but these errors were encountered: