Lets say I have
case class Foo(_id: BSONObjectID, bars: Set[Bar])
case class Bar(_id: BSONObjectID, name: String)
How can I get the bars
of a specific Foo
using projections?
I tried (omitting the declaration of the handlers)
val bars: Future[Option[Set[Bar]]] = fooes.find(
BSONDocument("_id" -> BSONObjectID("specificId")), // Match condition
BSONDocument("_id" -> 0, "bars" -> 1) // Projection
).cursor[Bar]().collect[Set]()
But it doesn't work.
Regards