0.12 release date / aggregation lookup in 0.11

47 views
Skip to first unread message

Reto Hablützel

unread,
Aug 31, 2016, 4:24:52 AM8/31/16
to ReactiveMongo - http://reactivemongo.org
hi,

I wanted to use the lookup stage in the an aggregation pipline but found that 0.11 doesn't implement it and the PipelineOperator is a sealed trait. I understand it has been added to the 0.12 branch though.

Do you already know when the final 0.12 version is going to be released? If it is within the next two weeks, I'll wait. Otherwise, I'll have to either think about backporting the lookup or somehow work around it. Although the latter may be a little cumbersome given the aforementioned sealed trait (does it really need to be sealed? While this may be cool from a type safety perspective, I think it sacrifices quite a bit of flexiliby for users).

Thanks.

- Reto

Cédric Chantepie

unread,
Aug 31, 2016, 8:06:41 AM8/31/16
to ReactiveMongo - http://reactivemongo.org
You can use 0.12-RC3

Reto Hablützel

unread,
Sep 2, 2016, 3:13:55 AM9/2/16
to ReactiveMongo - http://reactivemongo.org
Alright -- thanks.

On Wednesday, August 31, 2016 at 2:06:41 PM UTC+2, Cédric Chantepie wrote:
You can use 0.12-RC3

Ori Popowski

unread,
Sep 4, 2016, 2:32:57 PM9/4/16
to ReactiveMongo - http://reactivemongo.org

Hi,

If you _do_ want to wait to the release and still be able to use the $lookup directive you can already do that using custom commands.

The following aggregation pipeline example is taken from MongoDB's official docs:

 
   val pipeline = BSONDocument(
     
"aggregate" -> "orders",
     
"pipeline" -> BSONArray(
       
BSONDocument(
         
"$unwind" -> "$specs"
       
),
       
BSONDocument(
         
"$lookup" ->
           
BSONDocument(
             
"from" -> "inventory",
             
"localField" -> "specs",
             
"foreignField" -> "size",
             
"foreignField" -> "inventory_docs"
           
)
       
),
       
BSONDocument(
         
"$match" -> BSONDocument("inventory_docs" -> BSONDocument("$ne" -> BSONArray()))
       
)
     
)
   
)

    val runner
= Command.run(BSONSerializationPack)
   
for {
      result
<- runner.apply(collection.db, runner.rawCommand(pipeline)).one[BSONDocument]
   
} yield {
      read
(result).head[BSONDocument]
   
}

Reto Hablützel

unread,
Sep 4, 2016, 4:27:53 PM9/4/16
to ReactiveMongo - http://reactivemongo.org

Oh, thanks for the hint!

- Reto


--
You received this message because you are subscribed to a topic in the Google Groups "ReactiveMongo - http://reactivemongo.org" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/reactivemongo/voogDEBfxrA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to reactivemong...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
PGP
Key ID = 0x67D30264
Fingerprint = E235 F740 4419 5B4B 29EC  3437 CBF2 2CB7 67D3 0264

Cédric Chantepie

unread,
Sep 4, 2016, 5:21:46 PM9/4/16
to ReactiveMongo - http://reactivemongo.org
Reply all
Reply to author
Forward
0 new messages