A few questions about Moped and Origin

450 views
Skip to first unread message

brahmana

unread,
Feb 16, 2012, 5:39:14 AM2/16/12
to Mongoid
Hi,

I recently came across the post which specified that Mongoid will no
longer use the official Mongo Ruby driver, but will instead use new
Moped driver and also will be using the Origin gem to build MongoDB
queries.

After this I combed through the archives of this list and also looked
at the issues list of mongoid to see if there has been any discussion
or announcement about the beginning on these two new tools, but found
nothing. So here are a few questions related to that :

(Please note that I am not criticizing the work with these question
but only trying to understand the idea behind these two new gems. All
in all I am very excited to see so much activity around Mongoid. :) )

1) What was the motivation to build a new MongoDB driver altogether?
What is the rationale behind it, considering that Mongo has an
official ruby driver and maintaining a new driver will involve
considerable work with every new feature of MongoDB?

1.1) Is this implementation so different than the official driver
implementation that it had to a totally new gem v/s pull requests to
the official driver?

2) Moped mentions providing "fast APIs" in its goals. It however does
not have any native BSON implementation like the bson_ext to speed up
things. Would the pure ruby implementation be really faster than what
the official driver provides? Or is there a plan to bring in native
implementation sometime in the future.

3) Is Origin aimed at being something like : http://rubygems.org/gems/arel
for MongoDB ? From a brief glance of the Origin code it doesn't seem
to depend on any particular driver. It ultimately seems to deliver a
Hash which represents the query to be handed over to MongoDB and
thereby being pretty driver agnostic. Is that so?

Once again, thank you for the awesome work going on here and I hope to
raise a couple of useful pull requests soon. :)

Regards,
Brahmana

@sribrahmana (http://www.twitter.com/sribrahmana)

Durran Jordan

unread,
Feb 16, 2012, 6:02:43 AM2/16/12
to mon...@googlegroups.com
I'll have a detailed post on this at the end of the week, including full performance numbers, motivation, design decisions, etc. But to quickly answer your questions.

1. The implementation is quite different, and pull requests to the official driver that changed design (a long time ago) were not accepted.

2. Our driver and bson implementations are faster, even in pure Ruby, so there was no need to do native C. (It also makes it more stable across various operating systems, and JRuby users don't get penalized anymore - it's faster on the JVM than the Java bson implementation.)

    First run numbers are here: https://gist.github.com/1844063 with more optimizations to come from us as well.

3. Origin is basically just there to be a DSL to build query selectors, and has no dependency on any other gem. I wanted to do this so others could utilize the DSL that Mongoid has for it's criteria without needing to use Mongoid, or depend on any driver.


2012/2/16 brahmana <om.br...@gmail.com>

brahmana

unread,
Feb 16, 2012, 8:28:15 AM2/16/12
to Mongoid
Awesome. I love it when Ruby code comes out as FAST.. ! :) And I can
definitely imagine how happy the JRuby guys will be with Moped.
Also, I can already imagine myself using Origin in my non-rails
daemons which interact with MongoDB.

Thank you for the answers Durran. I am eagerly waiting for that long
post.

I generally hangout in #mongoid under the same name (brahmana). Do let
me know if I can contribute in any way - if not code at least docs.

Regards,
Brahmana

@sribrahmana (http://www.twitter.com/sribrahmana)

On Feb 16, 4:02 pm, Durran Jordan <dur...@gmail.com> wrote:
> I'll have a detailed post on this at the end of the week, including full
> performance numbers, motivation, design decisions, etc. But to quickly
> answer your questions.
>
> 1. The implementation is quite different, and pull requests to the official
> driver that changed design (a long time ago) were not accepted.
>
> 2. Our driver and bson implementations are faster, even in pure Ruby, so
> there was no need to do native C. (It also makes it more stable across
> various operating systems, and JRuby users don't get penalized anymore -
> it's faster on the JVM than the Java bson implementation.)
>
>     First run numbers are here:https://gist.github.com/1844063with more
> optimizations to come from us as well.
>
> 3. Origin is basically just there to be a DSL to build query selectors, and
> has no dependency on any other gem. I wanted to do this so others could
> utilize the DSL that Mongoid has for it's criteria without needing to use
> Mongoid, or depend on any driver.
>
> 2012/2/16 brahmana <om.brahm...@gmail.com>

Durran Jordan

unread,
Feb 16, 2012, 8:35:56 AM2/16/12
to mon...@googlegroups.com
Just wait if we decide to actually do some C with it as well... We're still contemplating it. :)

2012/2/16 brahmana <om.br...@gmail.com>

Durran Jordan

unread,
Jun 4, 2012, 5:01:56 AM6/4/12
to mon...@googlegroups.com
Not yet, just been so busy trying to get everything finished... I am actually going to put it in the actual documentation thought instead of blogging it. I have an open issue for it:

https://github.com/mongoid/mongoid-site/issues/153

2012/6/4 David James <david...@gmail.com>
Did you get a chance to write that blog post? I'm catching up on all the Mongoid 3 info that I can.
Reply all
Reply to author
Forward
0 new messages