Search code examples
mongodbscalafoursquarelift

How to get some certain field only from a recordset?


I have this:

temp = place where (_.name matches p2) fetch()

Now, what i have to do to get just two field of that results? For example name and id.

Thanks in advance :)


Solution

  • With rogue, you can use :

    .select()
    

    In your case :

    temp = place where (_.name matches p2) select(_.name, _.id) fetch() 
    

    More example are available here (go to line 174) : Rogue QueryTest.scala