I tried a few different methods, but I think writing support for sorting is above my level.
It looks like postgres does allow you to sort using a function, but writing it requires more JS than I can really do.
If you ever had time, being able to specify a sort key and a direction would be very useful.
i might be able to tackle something this weekend, depends on how many other tasks i take on. i have a job that i love and bring home fun projects way too often, so my personal projects sometimes don't get as much love as they should.
If you ever got the time to, or anyone else who read this did, it'd be useful, but I'm sorry - I certainly didn't mean to pressure you to work on it.
I really appreciate everything you've done, and the project is amazingly helpful as it is.
I can do the sort at the application layer instead.
it's no big deal, i stopped working on this project for a while, didn't mean to actually abandon it! would be nice to make it a full replacement.
Too bad we already rewrote all our mongo code for postgres, I too would have liked to have this kind of project back then :D
@e1ven i saw that you have some further commits - anything you'd like to share? :)
I can send a pull request if you want, but it might need to be tidied up a bit after merging - I'm not a very good coder.
I added support for drop_table, and made some changes so it would run on the regular plv, rather than needing your fork. It works for my code, but I haven't extensively tested it.
i can always merge it into a branch - i'm going to spend some time over the thanksgiving holidays doing some work and writing a test harness for it.
i'm going to close this.
there are a couple of ways to accomplish this:
SELECT find('test') AS row
ORDER BY find_in_obj_int(row::json, '_id') DESC;
i have also started JerrySievert/mongolike-client which aims to be a fairly complete reimplementation of the mongodb node driver, which should help with this as well.
if this isn't enough, i can write a more intelligent find that pays more attention to index orders, but i wonder the utility if there is a compatible node implementation.