Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Moped 1.5.x conflicts with bson-ruby 2.x and later #381

Open
agis opened this issue Jul 17, 2015 · 0 comments
Open

Moped 1.5.x conflicts with bson-ruby 2.x and later #381

agis opened this issue Jul 17, 2015 · 0 comments

Comments

@agis
Copy link

agis commented Jul 17, 2015

In the process of upgrading the mongo driver I've stumbled upon an incompatibility with moped 1.5.3 and bson 3.1:

So when moped calls its #to_utf8_binary it actually calls bson's #to_utf_binary and not its own. This causes failures like this:

ArgumentError:
  wrong number of arguments (0 for 1)
# /Users/agis/.gem/ruby/2.1.5/gems/bson-3.1.2/lib/bson/string.rb:164:in `to_utf8_binary'
# /Users/agis/.gem/ruby/2.1.5/gems/moped-1.5.3/lib/moped/bson/extensions/string.rb:10:in `__bson_dump__'
# /Users/agis/.gem/ruby/2.1.5/gems/moped-1.5.3/lib/moped/bson/extensions/hash.rb:15:in `block in __bson_dump__'
# /Users/agis/.gem/ruby/2.1.5/gems/moped-1.5.3/lib/moped/bson/extensions/hash.rb:14:in `each'
# /Users/agis/.gem/ruby/2.1.5/gems/moped-1.5.3/lib/moped/bson/extensions/hash.rb:14:in `__bson_dump__'
# /Users/agis/.gem/ruby/2.1.5/gems/moped-1.5.3/lib/moped/bson/document.rb:36:in `serialize'
# /Users/agis/.gem/ruby/2.1.5/gems/moped-1.5.3/lib/moped/protocol/message.rb:136:in `serialize_selector'
# /Users/agis/.gem/ruby/2.1.5/gems/moped-1.5.3/lib/moped/protocol/message.rb:289:in `serialize'
# /Users/agis/.gem/ruby/2.1.5/gems/moped-1.5.3/lib/moped/connection.rb:153:in `block in write'
# /Users/agis/.gem/ruby/2.1.5/gems/moped-1.5.3/lib/moped/connection.rb:151:in `each'
# /Users/agis/.gem/ruby/2.1.5/gems/moped-1.5.3/lib/moped/connection.rb:151:in `write'

This blocks us from upgrading to mongo driver 2.x while using moped 1.5.

I guess that this also concerns other methods that both gems define in the same namespace, like #to_bson_cstring (see here and here).

A possible solution would be to update Moped's methods to use a different name, like to_utf8_binary_moped maybe.

@durran What do you think?

@agis agis changed the title Moped 1.5.x conflicts with bson-ruby 3.x Moped 1.5.x conflicts with bson-ruby 2.x and later Jul 17, 2015
agis added a commit to skroutz/moped that referenced this issue Jul 21, 2015
We rename Moped::BSON::Extensions::String#to_utf8_binary and
Moped::BSON::Extensions::Symbol#to_utf8_binary in order to avoid
conflicts with bson 2.x and later.

Fixes mongoid#381.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant