Where in & keeping the order

22 views
Skip to first unread message

Roch Delsalle

unread,
May 1, 2012, 1:01:37 PM5/1/12
to rogue...@googlegroups.com
Hi,

I would like to know if it's possible to do the same request and keep the results ordered like in my list ? 

Contact where(_.id in sorted.take(10).map(_._1)) fetch()

Thanks,

Roch

Jason Liszka

unread,
May 1, 2012, 1:04:52 PM5/1/12
to rogue...@googlegroups.com
This isn't something mongo supports. Mongo will return results sorted in natural (disk) order unless you specify a field to sort on. So you'll have to do what you want in code.

Jason

Roch Delsalle

unread,
May 1, 2012, 1:07:01 PM5/1/12
to rogue...@googlegroups.com
Hi Jason,

Thank you for your quick answer,

Roch

2012/5/1 Jason Liszka <jli...@foursquare.com>
Reply all
Reply to author
Forward
0 new messages