Skip to content

Instantly share code, notes, and snippets.

@bwmcadams
Created November 6, 2011 22:22
Show Gist options
  • Save bwmcadams/1343659 to your computer and use it in GitHub Desktop.
Save bwmcadams/1343659 to your computer and use it in GitHub Desktop.
implicit def kvPairAsDBObject[A <: Any](kv: (String, A)): DBObject = MongoDBObject(kv)
sealed class NestedListOper(outerField: String) {
def apply[A <% DBObject](fields: A*): DBObject = {
val b = Seq.newBuilder[DBObject]
fields.foreach(x => b += x)
MongoDBObject(outerField -> b.result())
}
}
trait OrOp extends BarewordQueryOperator {
/* def $or[A : ValidBarewordExpressionArgType](fields: A*) =
MongoDBObject("$or" -> implicitly[ValidBarewordExpressionArgType[A]].listify(fields))*/
def $or = new NestedListOper("$or")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment