3

I have many records with below structure saved in mongodb.

case class User(_id:ObjectId = new ObjectId, email:String, role:String, employeeID:Int, createdOn:DateTime)

How can I execute the "IN" like query on mongodb using salat?

e.g.

val data = UserDAO.find(MongoDbObject("employeeID" -> List(2,4,5)) // (NOT working)

Thanks Pawan

Daniel C. Sobral
  • 295,120
  • 86
  • 501
  • 681
pawank
  • 113
  • 7

1 Answers1

6

With Casbah DSL:

import com.mongodb.casbah.query.Imports._

val data = UserDAO.find("employeeID" $in List(2,4,5))
Sergey Passichenko
  • 6,920
  • 1
  • 28
  • 29