def pullOnStart(): DBObject = {
val gooserQuery = MongoDBObject("status" -> MongoDBObject("gooser" -> "taken"))
val gooserUpdate = MongoDBObject("status" -> MongoDBObject("loader" -> "green"))
val gooserUpdateSet = MongoDBObject("$set" -> gooserUpdate)
collection.findAndModify(
case Some(doc) =>
doc.put("status", MongoDBObject("loader" -> "green"))
doc
case None => null
}
val phanterTakenGet = MongoDBObject("status" -> MongoDBObject("phanter" -> "taken"))
val phanterTakenSet = MongoDBObject("status" -> MongoDBObject("gooser" -> "yellow"))
val setPhanter = MongoDBObject("$set" -> phanterTakenSet)
collection.findAndModify(
case Some(doc) =>
doc.put("status", MongoDBObject("loader" -> "green"))
doc
case None => null
}
}
댓글 없음:
댓글 쓰기