Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package moduleupload
- import com.mongodb.casbah.Imports._
- import scalax.io._
- object Transform {
- val mongoClient = MongoConnection()
- val db = mongoClient("test")
- val modules = db("test")
- def main(args: Array[String]) {
- val docs = modules find ("style" $exists false)
- val (failed, altered) = docs.partition(work)
- //apparently does nothing
- altered map {x =>
- println("map: ")
- println(x)
- }
- //prints the documents
- altered foreach {x =>
- println("foreach: ")
- println(x)
- }
- }
- def work(_item: DBObject): Boolean = {
- val item: MongoDBObject = _item;
- item.get("z").isEmpty
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement