bcg / em-mongo

EventMachine MongoDB Driver (based off of RMongo)
http://github.com/bcg/em-mongo
141 stars 47 forks source link

Fixed JRuby #29

Closed ayosec closed 13 years ago

ayosec commented 13 years ago

The commit 23b53235 uses pack("c*") to transform the read data before to send it to BSON::BSON_CODER.deserialize.

In MRI all the tests pass.

With JRuby 1.5.1 I had to remove the bson_ext dependency, since it doesn't work with old JRuby. IMO, the em-mongo gem should not depend directly on bson_ext. With MongoID the bson_ext is optional, so the application can decide use it or not.

After remove bson_ext, all test passed with JRuby 1.5.1

With JRuby 1.6.4 the bson_ext can be used, but there is a failed test. After some debugging it seems that the problem is not related to em-mongo (maybe a bug in the bson gem, or even a problem compiling JRuby).

You can see the results for JRuby 1.6.4

The problem is only related adding a regular expression to a document. If I remove the line with the regex all the tests pass with no errors. I will try to detect the origin of the error, but at least the em-mongo can be used with JRuby.

There is another commit, which fixes the use of Dir.tmpdir. This method returns the generic tmp directory (at least on Linux), so it should not be used as the database path for MongoDB. The fix is not related with JRuby, but it is necessary to run the tests on any platform where the /tmp/is accessed by other processes.

bcg commented 13 years ago

I cherry picked 04eb6ec, but am concerned about 23b5323 because of pull request 31. 31 really helps in loading large documents.

I put together my own pull request from christophstrum's patches that I believe fixes #25. Could you have a look at 32?

ayosec commented 13 years ago

PR #32 works well on JRuby. There are still some little issues (in this pull request too), but at least it is usable.

Thanks!