4 ms·
My weekend project: MongoDB implementation in Ruby
- thegdb 15y agoOne really nice part about the implementation was I could just reuse the Ruby Mongo driver's test suite.
- websymphony 15y agoInteresting. So now I can test my mongodb app, without needing to install mongodb server on my machine? Cool!
- mdda 15y agoLooks great! But the stinger is in the tail : "I think the next thing to add is indexes. Currently everything works via a linear scan of the database."
- thegdb 15y agoThanks. Re: indexes - patches welcome :). I don't expect them to be hard to build though. Since embedded-mongo is in memory, they're just a bunch of hash tables.
- mdda 15y agoIn that case, I would think that the indexing stuff (i.e. hash lookups) would be way better than linear already. Cool.
- benatkin 15y agoIt depends on what you use it for. Without indexes, it could be used for testing without setting up a local MongoDB server, as long as there aren't too many records.
- e1ven 15y agoThis seems really fun. I'd love to be able to use this almost like a version of SQLlite, but a JSON interface. I could see this in Android/iPhone, as well as Desktop apps.
- kcbanner 15y agoEmbedded MongoDB on Android would be awesome.
- cdcarter 15y agoCouchDB already has embeddable ports to Android and iOS, and it has the added benefit of a built in master-slave or multiple-master replication system, so you can have your app get and push up to date data from a server when a connection is available, but still be fully functional without it, for free!
- mathias_10gen 15y agoWhile this is a very nifty bit of code, I'd be very careful about using it for unit testing as there is a high likelihood of minor behavior differences verses a real mongod which can cause surprises in production. Also, for anyone looking to embed MongoDB and who doesn't mind using C++ it is possible and rather easy. In fact some of our unit tests and all of our tools other than the shell already do this. See https://github.com/mongodb/mongo/blob/master/tools/tool.cpp#L208-235 https://github.com/mongodb/mongo/blob/master/tools/tool.cpp#... for the details. The DBDirectClient class implements the full C++ driver interface but does all operations in-process. The downside is that unlike when using our drivers (which have no licensing impact on your code) when you embed mongodb within your application it becomes bound by AGPL. PS- That is really impressive for a weekend project! You should get in touch with us at 10gen if you're looking for a new job.
- thegdb 15y ago> While this is a very nifty bit of code, I'd be very careful about using it for unit testing as there is a high likelihood of minor behavior differences verses a real mongod which can cause surprises in production. Yep, that's a valid point. My plan is to run my tests most of the time with embedded-mongo, and run against real mongo on occasion (such as say, using embedded-mongo while developing locally and real mongo before pushing to production). I haven't benchmarked it yet, but my test suite seems to run a lot faster with embedded-mongo than real mongo. And it's definitely a lot less work to use than an ad-hoc mock layer. > PS- That is really impressive for a weekend project! You should get in touch with us at 10gen if you're looking for a new job. Thanks! If my current startup goes down in flames, I'll be sure to give you a call :).