2

I am using a ExtJS frontend and for a back end I'm using django, mongodb, and mongoengine (ORM - between the two). Everything works until i decide to shard my mongo database, turns out db.eval() (uses datbase to run commands) doesn't work with a sharded database. So I have to switch out the ORM.

I found several other ORMS such as mongokit and mongoalchemy, however I do not want to go through each individual ORM and hope that it works after changing all the commands from the recent ORM to the new one. Does anyone know a Mongo ORM that doesn't use db.eval() or works with a sharded mongo database?

Thank you

14
  • 1
    What are you doing with db.eval()? There might be a way to refactor that code to work with a shared system... Commented Aug 15, 2011 at 17:12
  • 1
    I meant, what specific task are you trying to accomplish? db.eval will not work on sharded collections, but this is a limitation of MongoDB itself, not of Mongoengine. See Sharding Limits for details. Commented Aug 15, 2011 at 17:54
  • 2
    MongoDB itself does not allow db.eval to be run against sharded collections. This is not a limitation of Mongoengine, but of MongoDB itself. Thus you won't be able to find an ORM/ODM which will let you do this. However, if you can describe what you ultimately want to accomplish, there may be another way to go about it that will work on sharded collections. Commented Aug 15, 2011 at 18:41
  • 1
    You realize that Mongoengine only uses db.eval for the exec_js() method, not for any others. If you don't use that in your own code, you can use Mongoengine just fine with sharding. Commented Aug 15, 2011 at 20:12
  • 1
    AFAIK mongoengine only uses db.eval if you call exec_js. Can you accomplish what you are trying to do without exec_js? This doesn't seem to be a mongoengine problem to me. Commented Aug 15, 2011 at 20:13

1 Answer 1

2

MongoEngine has now been updated not to use db.eval for the 2 areas that used it where map_reduce should have been used: sum and average. item_frequencies has been updated to default to using map_reduce over using exec_js & db.eval.

In the end it was a small update: https://github.com/hmarr/mongoengine/pull/256/files thanks to @dcrosta for the patch and letting me know this thread existed!

You can grab the latest shard happy code from the dev branch https://github.com/hmarr/mongoengine/tree/dev

Dont forget theres a mailing list for monogoengine - http://groups.google.com/group/mongoengine-users for any comments / issues or feedback and theres #mongoengine on irc

Cheers,

Ross

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.