简体   繁体   中英

Nested query DSL in casbah?

How can I do a nested and/or query in casbah?

For example:

val q =  $and( "a"->"b", $or("e"->"f", "e"->"g"), $or("c"->"d", "c"->"e") )

This sample doesn't compile, but that's the idea I'm trying to achieve.

文档说:“ $ or运算符对两个或多个表达式的数组执行逻辑或运算”,因为它是数组,所以您应该使用Seq来分隔条件。

coll.find(MongoDBObject("a"->"b","$or"->Seq(Map("e"->"f"),Map( "e"->"g")),"$or"->Seq(Map("c"->"d"),Map( "c"->"e"))))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM