0

setup

A TurboGears2 project using ming as an ORM for mongodb. I'm used to working with relational databases and the Django ORM.

question

Ming claims to let to interact with mongodb like it's a relational database and a common thing to do in a relational database is sort a query by a property of a foreign key. With the Django ORM this is expressed with double underscores like so: MyModel.objects.all().order_by('user__username')

Is there an equivalent for this in ming?

Community
  • 1
  • 1
rennat
  • 2,529
  • 3
  • 26
  • 30

1 Answers1

1

I have never used ming, but they seem to have a sort method that you can add to a query, check it out here, not much in the form of documentation

I use mongoengine, it has great documentation and its very similar to the django ORM

MattoTodd
  • 14,467
  • 16
  • 59
  • 76
  • Thanks @MattoTodd but I guess I should have specified that I'm aware of the `sort` method and have seen the documentation but still can't figure out how to sort using a related property – rennat Sep 22 '11 at 20:59
  • not sure how deep you are, but I can only recommend mongoengine. Querying is a breeze. The query would match the django orm version in this case – MattoTodd Sep 22 '11 at 21:01
  • I'm the new guy on an already established project so switching it out may not be an option. – rennat Sep 22 '11 at 21:04
  • sorry bro. like I said, not sure how deep you are in using ming, if it's already well established, then someone else on your team must have made a simlar query before. if its not well established, recommend mongoengine and you'll be a hero. – MattoTodd Sep 22 '11 at 21:06