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 :)
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 :)
You need to use the projection parameter which can limit the results to specific fields:
val q = MongoDBObject.empty
val fields = MongoDBObject("userid" ->, name" -> 1)
for (x <- mongoColl.find(q, fields)) println(x)
Assuming the basic connection and collections are properly referenced, the above code would return only userId
and name
.
With rogue, you can use :
In your case :
More example are available here (go to line 174) : Rogue QueryTest.scala