sorting by a related item with ming on mongodb
-
26-01-2021 - |
Question
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?
Solution
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow