Can't Get $elemMatch To Work With Projection In SalatDAO

14 views
Skip to first unread message

Neil Chaudhuri

unread,
Oct 21, 2014, 6:23:31 PM10/21/14
to scala...@googlegroups.com
I have an object model that looks like this:

"presentation": [
  "categories: [
     { "slug": "my-slug"},
     { "slug": "my-slug-2"}
  ]
]

I can do this in Casbah and get a result:


val coll = MongoClient()("mydb")("presentations")
coll.find("categories" $elemMatch MongoDBObject("slug" -> "my-slug")).count


I am trying to accomplish the same thing in SalatDAO with a projection on the Category case class. I've tried a million different ways, and none have worked. One of them is this:

projection[Category]("categories" $elemMatch MongoDBObject("slug" -> "category-1-1234"), "categories")

Can anyone give me the right way to do this?

Thanks.
Reply all
Reply to author
Forward
0 new messages